nirav
nirav

Reputation: 421

Orientation Problem in android

I am using two xml file on for landscape and another for portrait when i am trying to change my orientation landscape to portrait and portrait to landscape it shows the black screen I want to remove that black screen what i have to do for this problem

Upvotes: 0

Views: 536

Answers (1)

Aleadam
Aleadam

Reputation: 40401

OK, I understand now "that blank screen" is the delay in between while the activity is restarting.

How long does it take will strongly depend on what you're doing during onCreate(), since it is called every time the activity starts. You asked in the comments if threads will solve it: short answer, no, it's not that simple as spawning a new thread.

You may want to consider using onRetainNonConfigurationInstance() for the heavy objects in your activity. Take a look at this article for a excellent explanation: http://developer.android.com/resources/articles/faster-screen-orientation-change.html .

Alternatively, you can use static data in an Application class. See the Application as a Singleton post here: http://androidcookbook.com/Recipe.seam?recipeId=1218

Upvotes: 4

Related Questions