OK now I'm only turning the flag on in the onCreate() and onResume()
methods. It works fine on the HTC Magic phone, but in the emulator,
after it starts and I don't do anything on the home screen it doesn't
go off at all. When I start my app it doesn't go off like required,
but when I return back to the home screen it doesn't go off neither.

I don't know if this issue is severe enough to be considered an
emulator bug?

Lex

On Jul 14, 9:28 pm, Dianne Hackborn <[email protected]> wrote:
> 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 <[email protected]> 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
> [email protected]
>
> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to