Below a snippet of code that I use. It toggles between screen lock and
unlock. It's been a year or so that I've implemented this so I am not
sure if that's the whole story, but there you got:

<--------------- snip --------------->
                if (this.isMyAppsScreenLocked)
                // has been locked. release
                        this.setRequestedOrientation
(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
                else {
                // lock screen
                        Display display = ((WindowManager)getSystemService
(WINDOW_SERVICE)).getDefaultDisplay();
                        int orientation = display.getOrientation();
                        if (orientation == 0)
                                this.setRequestedOrientation
(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
                        else
                                this.setRequestedOrientation
(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
                }
                this.isMyAppsScreenLocked = !this.isMyAppsScreenLocked;

<--------------- snip --------------->


On Jan 14, 11:57 am, OldSkoolMark <m...@sublimeslime.com> wrote:
> Users of my application will engage a feature that temporarily uses
> the accelerometer. I would like to disable support for orientation
> changes while this feature is active. Is there an API for this?
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to