Splash activity
public static final long TIME = 3000;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.logo);
Protocol.getInstance(this);
Thread welcomeThread = new Thread() {
@Override
public void run() {
try {
sleep(TIME);
} catch (Exception e) {
Log.e(getClass().getName(), e.toString());
} finally {
startActivity(new Intent(LaunchScreen.this,MainScreen.class));
finish();
}
}
};
welcomeThread.start();
}
logo.xml file:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="right" > <ImageView android:id="@+id/logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/logo" android:layout_centerInParent="true" > </ImageView> </RelativeLayout>
in AndroidManifest :
<activity android:name=".LaunchScreen"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".MainScreen" android:label="@string/app_name" ></activity>
from http://stackoverflow.com/questions/8642730/splash-screen-in-android-application