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
Trusted Contributor
Posts: 108
Registered: ‎01-18-2012
My Device: 9360
My Carrier: AIRTEL

difference between onExposed on onUiEngine attached methods

Hi,

 

what is the difference between onExposed on onUiEngine attached methods ?

 

thx

srinivas

Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: difference between onExposed on onUiEngine attached methods

onUiEngineAttached is called in two cases - when a screen is pushed onto the screen stack (with true for parameter value) and when it is popped from it (false).

onExposed is called each time a screen becomes visible (unobscured) - whether it is pushed onto the screen stack or the last screen above it is popped from the stack, or the application is brought to the foreground with this screen already on top.

 

HTH.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: difference between onExposed on onUiEngine attached methods

Just to clarify, onExposed is not called when the screen is first pushed.  It is only called when something might have hidden it and now no longer does.

 

Note that onExposed and onObscured also apply to Fields as does onDisplay and onUndisplay (which are the Field counterparts to onUiEngineAttached).  These can be very useful, for example if you want to start updating a Field when it is visible (onDisplay or onExposed), stop updating a Field that is not visible (onObscured) and stop the processing when it is removed (onUndisplay)..

Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: difference between onExposed on onUiEngine attached methods

There is another useful method in Field - onVisibilityChange. It is called, I believe, after the repainting of the screen due to the latest push/pop operation has been completed. Previously mentioned methods all happen just before the related paint. Useful to know if you plan on, say, taking screenshots or injecting events.

 

And yes, onExposed is not called when the screen is first pushed onto the stack. I guess I confused it with onVisibilityChange in my previous post. Haven't worked with those for a while, even though I found them all extremely useful when I did.

 

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!