Question

My app is built with the support ActionBar to allow for a standard UI between Android 4.x and Android 2.3, and for the most part this works fine. However, the title is not displayed in the ActionBar when I first launch the app under Android 2.3.

If I rotate the device to landscape mode, then the title appears in the ActionBar. After rotating the device back to portrait mode, the title is still visible.

What could be causing this? When I launch a different Activity in the app, that Activity's label (as specified in AndroidManifest.xml) is correctly displayed in the ActionBar.

EDIT: I've tracked this down to a splash screen Activity that is launched from the main activity's onCreate method. I can probably work around this be rearchitecting the app to launch with the splash screen as its default launch activity and then launch the main activity, but are there any other workarounds?

Unfortunately, I don't think "remove the splash screen" will be acceptable.

Was it helpful?

Solution

As far as I can tell, this issue is a bug in Android 2.3. It seems like this problem was caused by my launch Activity starting another Activity (the splash screen) from its onCreate method. Moving the splash screen launch to onStart or onResume did not help to resolve this issue.

I was able to work around the issue by replacing the internals of my launch Activity with the splash screen and creating a new "real main Activity" that the splash screen Activity launches.

It was important to keep the same class as the launch Activity because the app has already been released, and changing the class of the launch Activity would break shortcuts for users who have already installed the app.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top