10-21-2011 05:30 AM
i am new to blackberry..
in my app i am displaying one image in potrait mode..once when i change more i have to update x and y position..
where i can update there changes...?
10-21-2011 10:43 AM
sublayout gets called when a manager is first displayed, when the phone orientation changes, when fields are deleted, added or replaced and when a field requests to re-layout (for example, when you type in EditField, it will eventually go out of its current boundaries and try to word-wrap; at this moment, it will invoke updateLayout).
What you seem to want (place an image depending on the screen orientation) is not the easiest task. It is best done with either a custom manager or, say, an AbsoluteFieldManager with its setPosChild method (don't confuse with setPositionChild - the latter can be called only inside sublayout and is the tool to use in a custom layout manager). Make sure that you don't invoke setPosChild if the position is already correct (can find out by calling the field's getExtent and checking its x and y) - otherwise you'll create an infinite loop of sublayout invocation.