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 Developer
Posts: 81
Registered: ‎03-22-2013
My Device: 9900,9930,9790,9780,9330
My Carrier: Blackberry

Background to foreground event

Hello All,

I want to develop the application which checks background to foreground event. Using onExposed() method its working fine but onExposed() call frequently not only for background to foreground event but  when other screens gets call or on custom fields such as dropdown,popup,dialog,.. My method contains webservice call and lots of checking on web . So this call is written in onExposed() due to that my application becomes too slows. So Please tell me way to check only background to foreground event handling mechanism.

 Thanks 

Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Background to foreground event

You can use activate/deactivate in the Application class
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 81
Registered: ‎03-22-2013
My Device: 9900,9930,9790,9780,9330
My Carrier: Blackberry

Re: Background to foreground event

I tried this but it  not works Please tell me any othe way for this..

Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Background to foreground event


BB_Developement wrote:

I tried this but it  not works Please tell me any othe way for this..


Can you give a code snippet of your try?

I am using it in several applications successfully.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 81
Registered: ‎03-22-2013
My Device: 9900,9930,9790,9780,9330
My Carrier: Blackberry

Re: Background to foreground event

[ Edited ]

Thanks for your quick reply

I tried this by putting simple Dialog in activate() method  But its not  works for  background to foreground event.

On Dialog it shows warning as  "Warning!: method 'mypackage.MyScreen.activate()' not invoked."

Please tell me why this warning comes in case of activate() not for onExposed() method.

Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Background to foreground event

activate() is a method of (Ui)Application, not of Screen.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter