Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
ganeshkumarrr
Posts: 9
Registered: ‎04-04-2011
My Device: 9550
My Carrier: ASA

Get System or Screen Lock

Hi,

 

I need to push a UI screen when the user press the lock button or key pad lock or screen lock, 

I need to implement from the os 4.5 onwards to 6.0 or above.

I tried the following methods but no result...

 

* Appl...isSystemLock();

 

* The following code after the app entertheEventDispatch()

 

 MemoryCleanerDaemon.addListener    (new MemoryCleanerListener() { 

        public boolean cleanNow(int event) { 

            if (event==MemoryCleanerListener.EVENT_DEVICE_LOCK){ 
                //do something   

          Dialog.alert("Event Device lock "); 
             }   

           return false; 
        }   

      public String getDescription() {     

        // TODO Auto-generated method stub     

       return "listener";     

     }    

     });

 

Please give the optimal solution.

 

Thanks in advance...

 

 

Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Get System or Screen Lock

What does "no result" mean?

 

Are you aware that you cannot display a dialog from the context of the listener? Only the event thread may display a dialog or access the UI.

 

Did you try a sinple "System.out.println()" here instead, to verify that your listener is actually being called?

 

Please use plain text.
New Contributor
ganeshkumarrr
Posts: 9
Registered: ‎04-04-2011
My Device: 9550
My Carrier: ASA

Re: Get System or Screen Lock

 Hi, 

Thanks for ur reply...

I tested it with system.out.println...but at locking time It is not displayed..

 

The listener is not being called...

 

How can I solve the issue?

 

Thanks

Ganesh.

 

 

 

Please use plain text.