I'm developing an application in android 2.2.
When change the device orientation (by rotate the device) an black screen is painted in the bounds of my Activity (there is no even the Activity title), it takes some seconds (7-15 seconds) and then the activity is finally painted.
I have tested it emulator and two different devices and the behavior is the same.
In LogCat I have the next output:
02-02 09:18:06.044: WARN/WindowManager(1300): MyActivity freeze timeout expired.
02-02 09:18:06.044: WARN/WindowManager(1300): Force clearing freeze: AppWindowToken{4515af88 token=HistoryRecord{44f52458 com.project.package/.MyActivity}}
02-02 09:18:08.054: WARN/WindowManager(1300): Window freeze timeout expired.
02-02 09:18:08.054: WARN/SurfaceFlinger(1300): timeout expired mFreezeDisplay=1, mFreezeCount=0
02-02 09:18:08.054: WARN/WindowManager(1300): Force clearing orientation change: Window{45178a00 com.project.package/com.project.package.Activity paused=false}
I don't know why is it happening. Thanks for the comments, suggestion, answers.
Some device configurations can change during runtime (such as screen orientation, keyboard availability, and when the user enables multi-window mode). When such a change occurs, Android restarts the running Activity ( onDestroy() is called, followed by onCreate() ).
If the Android screen rotation not working happens to you , or you're just not a fan of the feature, you can re-enable screen auto-rotate on your phone. Find and turn on the "Auto-rotate" tile in the quick-setting panel. You can also go to Settings > Display > Auto-rotate screen to turn it on.
By default, your device's screen will not rotate when you are on the Home screen, but you can change this. Simply go to your Home screen settings to make your Home screen rotate sideways. To check other rotation settings, open the Quick settings panel by swiping down from the top of the screen.
Swipe down from the top-right corner of your screen to open Control Center. Tap the Portrait Orientation Lock button to make sure that it's off.
Thanks for the comments, sorry for the late answer.
The problem was a large, very large list that I have in my application (close to 2000 rows in a ListView). If I do not draw that list, the application is fine.
It is understandable, 2000 rows, every one with an icon and text, are too much!.
So I have decided to implement an index, or the very intelligent list of android Market (this list is great, is not indexed, but only draw the rows that you are close to see).
I suppose that, when the device rotate (with the large list) it tries to remove the references, or something like that, and it takes a long time, and a timeout is thrown, and that is what shows the black screen. But it is just a supposition
I have tried to clean the list in onPause() but it does not solve the problem.
Anyway the problem was : too much View objects in an Activity. the solution for me: use an indexed list (do not use to much View objects in an Activity).
Hope this will be useful for other people.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With