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.
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.