Reputation: 24069
On iOS you create a load screen for when the app loads, is there a similar thing in Android. When my app loads, I get a black screen until it opens.
Upvotes: 0
Views: 2025
Reputation: 16974
I'm in no way a iOS expert, but if you're referring to a splash screen, you can do the following:
Create an Activity that it's intent-filter category is set as LAUNCHER in the manifest... say you call it Splash:
<activity
android:label="@string/app_name"
android:name=".Splash" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Then in the new Activity onCreate
execute a postDelay
to start a new Intent:
new Handler().postDelayed(new Runnable() {
public void run() {
Intent intent = new Intent();
intent.setClass(Splash.this, MyMainActivity.class);
Splash.this.startActivity(intent);
Splash.this.finish();
}
}, 3000); // splash will show for 3 seconds
Upvotes: 2
Reputation: 3591
You could display an Activity with a custom View that displays on animated image (using the LayoutInflater to inflate, and an Animation to animate it). Thats how I did it.
Upvotes: 0
Reputation: 2373
Just make your main (startup) screen an ImageView (or whatever you want your splash screen to have) and then call StartActivity()
to start your real main screen.
Upvotes: 0