You don't even need to clear it. This flag is associated with the window, and it will only keep the screen on while your window is displayed. I really can't explain the behavior you say you are seeing, if your window is not displayed this flag simply will not keep the screen on.
On Tue, Jul 14, 2009 at 12:21 PM, Lex <hakkinen1...@gmail.com> wrote: > > Hi, > > I have a map activity for which I would like to have the screen turned > on as long it's active (the app consists of one activity only). When > the activity is paused or stopped I want to return to normal on/off > mode. Keeping the screen on works fine while the app is running but > when I exit the app the screen stays on as well. What am I missing? > > public void onCreate(...) { > > getWindow().addFlags > (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); > setContentView.... > } > > > public void onPause(...) { > > getWindow().cleaFlags > (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); > } > > public void onResume(...) { > > getWindow().addFlags > (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); > > } > > public void onStop(...) { > > getWindow().cleaFlags > (WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); > } > > > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---