开发者

Orientation Problem in android

开发者 https://www.devze.com 2023-03-10 09:10 出处:网络
I am using two xml file on for landscape and another for portrait when i am trying to change my orientation landscape to p开发者_Python百科ortrait and portrait to landscape it shows the black screen

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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号