开发者

Android: How do I make sure the screen has fully rotated?

开发者 https://www.devze.com 2023-04-12 20:47 出处:网络
I am writing an Android application that needs to rotate the screen as many times as possible in a certain period of time.

I am writing an Android application that needs to rotate the screen as many times as possible in a certain period of time.

I can rotate the screen fine with setRequestedOrientation(int). The problem I am having is that if I try and rotate the screen in the last call to Activity, onWindowFocusChanged(boolean), the screen cannot keep up with the amount of times setRequestedOrientation is called.

My logcat is showing me that I am getting roughly 5-10 "Setting rotation to [0|1|2|3]" before I get one complete screen rotation.

Here's what I have tried:

  • Using view to request focus and using a OnRequestFocusChanged Listener
  • Rotating screen in a child thread to run runOnUiThread to add to main thread message queue
  • View.post

I know iv'e tried other stuff, but I forget, those are the most recent, and as you can tell I'm getting desperate.

So, is ther开发者_如何学Goe a way to make sure that the Activity has fully rotated and is accepting user input? Maybe there is a way to check and see if the Activity is looping and waiting for input? Any help here would be absolutely great! Thanks guys.

0

精彩评论

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