开发者

Intent for screen orientation change

I'm wondering whether android broadcasts a intent when the screen orientation changes. I am programming a live wallpaper and want to deal开发者_运维技巧 with it when the screen orientation changes. I can handle the same with regular apps.


Android system doesn't broadcast an Intent, but restarts the activity by default. If you want to override this you should override onConfigurationChanged(Configuration) method of your activity. To get this method called you should also specify the changing in android:configChanges attribute in your manifest file.

See what and how to specify here.


I think "android.intent.action.CONFIGURATION_CHANGED" is what you want.


I don't think it does, but you can always check the configuration at a repeating interval to see if it changed. To get the configuration call getResources().getConfiguration() and inspect the orientation.


Well if the app is not in the foreground, this

"onConfigurationChanged(Configuration)"

method does not work (for example when the app displays an overlay in a service)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜