1

I'm developing an application in android, where the app starts with a splash screen. I declared the splash activity as launcher activity in the manifest, but when I start my app, the launcher always shows up a grey activity with no content instead of the actionbar with the title of my app. The splash activity always comes up after one or two seconds.

Can anyone explain this behavior to me?

Here's my manifest:

 <application
    android:allowBackup="true"
    android:hardwareAccelerated="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:logo="@drawable/navigation"
    android:theme="@style/Theme.Sherlock.Light" >
    <activity
        android:name="de.test.basic.SplashActivity"
        android:launchMode="singleTask"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity></application>

And here's the onCreate() method of the SplashActivity:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.spash_screen);
    img = (ImageView) findViewById(R.id.imageView1);
    img.setImageResource(R.drawable.splashscreen);
    getActionbar().hide();
    slideMenu.setSlidingEnabled(false);

    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            startActivity(new Intent(SplashActivity.this,
                    OtherActivity.class));
            overridePendingTransition(android.R.anim.fade_in,
                    android.R.anim.fade_out);
            finish();
        }
    }, SPLASH_DELAY);

}

Thanks for any help :)

Siddharth
  • 9,349
  • 16
  • 86
  • 148
jennymo
  • 1,450
  • 1
  • 18
  • 43
  • why are not using appstartActivity to start Splash screen – Yogesh Tatwal Jul 02 '13 at 08:11
  • Depends what device the user uses...for ldpi the screens size has 320x480 size with 218kb. mdpi is 640x960 with 730kb, hdpi has 640x1136 and 775kb and xhdpi at least uses 1 mb with 800x1280 – jennymo Jul 02 '13 at 08:13
  • possible duplicate of [How to hide action bar before activity is created, and then show it again?](http://stackoverflow.com/questions/8500283/how-to-hide-action-bar-before-activity-is-created-and-then-show-it-again) – Siddharth Jul 02 '13 at 18:01

1 Answers1

2

Looks like its a bug in the api!

Simply add this in your starter activity declared in your manifest:

<activity
    ...
    android:theme="@style/Theme.NoActionBar" >

    <intent-filter>
        ...
    </intent-filter>
</activity>

And if you are using ActionBarSherlock

<activity
    ...
    android:theme="@style/Theme.Sherlock.NoActionBar" >

    <intent-filter>
        ...
    </intent-filter>
</activity>

Your question is rather similar than this one

Community
  • 1
  • 1
Gomino
  • 12,127
  • 4
  • 40
  • 49