Ok. I was able to reproduce the problem, but it happened only twice
( I must have tried it about 12~15 times).

I also found this discussion thread .
http://groups.google.com/group/android-developers/browse_thread/thread/a9c4c2fd37f8f6a6

I assume you have a reference to mWakeLock object, I do in my test
program.

Seems like a timing issue. The GC kicks in before the
PowerManagerService is able to service the release of the WakeLock.

Maybe one of the Android Framework Engineers would like to reply to
this one :)

Balwinder Kaur
Mobile.Software.Development
·T· · ·Mobile· stick together

The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.



On Oct 16, 1:43 am, Chris <themaninthesuitc...@googlemail.com> wrote:
> Occurs on both emu (the 1.6 one) and a HTC Hero (running latest rom
> which is a 1.5 one).
>
> SDK is the latest using the 1.5 API.
>
> The finish is in a onClick handler (allowTapToClose is a private
> member)
> public void onClick(View v) {
>                 if (allowTapToClose) {
>                     setResult(RESULT_OK);
>                     finish();
>                 }
>             }
>
> out side of the calls posted it doesn't really do very much it's just
> a display;ay at the moment.
>
> On 15 Oct, 18:13, "Balwinder Kaur (T-Mobile USA)" <balwinder.k...@t-
>
> mobile.com> wrote:
> > Could you please post the rest of your code - or at least the portion
> > where you "call finish". I can't reproduce your problem with the
> > information that is present.
>
> > Also, what version of the SDK are you using and where are you seeing
> > this problem..on a device (which one) or the emulator (which
> > platform) ?
>
> > Thanks,
> > Balwinder Kaur
> > Mobile.Software.Development
> > ·T· · ·Mobile· stick together
>
> > The views, opinions and statements in this email are those of the
> > author solely in their individual capacity, and do not necessarily
> > represent those of T-Mobile USA, Inc.
>
> > On Oct 15, 2:51 am, Chris <themaninthesuitc...@googlemail.com> wrote:
>
> > > I am using a PowerManager.WakeLock to lock to stop the screen auto
> > > diming after a period of non use.  This works fine up until I try to
> > > release the lock.
>
> > >     private void aquireBacklightLock() {
> > >         PowerManager pm = (PowerManager) getSystemService
> > > (Context.POWER_SERVICE);
> > >         mWakeLock = pm.newWakeLock
> > > (PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "mTag");
> > >         mWakeLock.acquire();
> > >     }
>
> > >     private void releaseBacklightLock() {
> > >         if (mWakeLock != null) {
> > >             mWakeLock.release();
> > >         }
> > >     }
>
> > > The aquireBacklightLock is called when the activity is created or
> > > resumed.  releaseBacklightLock is called in the onPause.  However, if
> > > I exit the app (I call finish) I get a force close a few seconds
> > > later.  The logcat is saying WakeLock finalized while still held.
>
> > > Where am I going wrong?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to