Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. public class SplashScreen extends Activity implements Runnable {
  2.  
  3. @Override
  4. public void onCreate(Bundle savedInstanceState) {
  5. super.onCreate(savedInstanceState);
  6. setContentView(R.layout.splash);
  7.  
  8. Handler handler = new Handler();
  9. // define o tempo de execução em 3 segundos
  10. handler.postDelayed(this, 3000);
  11. }
  12.  
  13. public void run(){
  14. // inicia outra activity após o termino do tempo
  15. startActivity(new Intent(this, ActivityMain.class));
  16. finish();
  17. }
  18. }
  19.  
  20. <?xml version="1.0" encoding="utf-8"?>
  21. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  22. android:orientation="vertical"
  23. android:layout_width="fill_parent"
  24. android:layout_height="fill_parent">
  25.  
  26. <ImageView
  27. android:layout_width="wrap_content"
  28. android:layout_height="fill_parent"
  29. android:layout_gravity="center"
  30. android:src="@drawable/imagem"/>
  31.  
  32. </LinearLayout>
  33.  
  34. <application android:icon="@drawable/ic_laucher" android:label="@string/app_name" android:debuggable="true">
  35.  
  36. <activity android:name="SplashScreen" android:label="@string/app_name">
  37. <intent-filter>
  38. <action android:name="android.intent.action.MAIN" />
  39. <category android:name="android.intent.category.LAUNCHER" />
  40. </intent-filter>
  41. </activity>
  42.  
  43. <activity android:name="ActivityMain" android:label="@string/app_name">
  44. <intent-filter>
  45. <action android:name="android.intent.action.MAIN" />
  46. </intent-filter>
  47. </activity>
  48. </application>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement