04-09-2012 12:57 PM
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.
04-09-2012 02:49 PM
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)..
04-09-2012 03:04 PM
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.