Hi All,
I get a Runtime exception when my wait lock gets expired . Is it
because I am trying to release a lock that was acquired with a
timeout?

I am using the following code to acquire the wakelock before a view is
activated.

        private PowerManage.WakeLock  wakeLock;
        public  void    acquireWakeLock(Context ctx){
                if(wakeLock != null && wakeLock.isHeld())       
releaseWakeLock();
                PowerManager pm = (PowerManager)
ctx.getSystemService(ctx.POWER_SERVICE);
                wakeLock = 
pm.newWakeLock(PowerManager.FULL_WAKE_LOCK,"UiManager");
                wakeLock.acquire(WAKE_LOCK_DURATION);
        }

      /** this is called only from the above function **/
        private    void releaseWakeLock(){
                if(wakeLock != null && wakeLock.isHeld()){
                        wakeLock.release();
                }
                wakeLock = null;
        }

TIA

-- 
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