Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class SplashScreen extends Activity implements Runnable {
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.splash);
- Handler handler = new Handler();
- // define o tempo de execução em 3 segundos
- handler.postDelayed(this, 3000);
- }
- public void run(){
- // inicia outra activity após o termino do tempo
- startActivity(new Intent(this, ActivityMain.class));
- finish();
- }
- }
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <ImageView
- android:layout_width="wrap_content"
- android:layout_height="fill_parent"
- android:layout_gravity="center"
- android:src="@drawable/imagem"/>
- </LinearLayout>
- <application android:icon="@drawable/ic_laucher" android:label="@string/app_name" android:debuggable="true">
- <activity android:name="SplashScreen" android:label="@string/app_name">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity android:name="ActivityMain" android:label="@string/app_name">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- </intent-filter>
- </activity>
- </application>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement