user interface - IlegalStateException: Layout requested during layout -


i trying set labelfield text during layout (inside layout() method) depending on display's orientation in following way:

labelfield roomdesclabel = new labelfield("", field.field_vcenter) {     protected void layout(int width, int height) {         if (display.orientation_landscape == orientation) {             settext("landscape");         } else {             settext("not landscape");         }         super.layout(width, height);     } }; 

sometimes, catching illegalstateexception layout requested during layout message. message makes sense since that's doing (i calling settext() in turn requests layout update). there acceptable way set text value depending on display's orientation?

i've found solution issue not totally satisfied it. solution override labelfield manager's sublayout() method , replace existing label field new 1 updated text (and call super.sublayout()). surprisingly, workaround works expected , not triggering layout update.

update: possible solution call invokelater() settext() operation in layout() method of labelfield. disadvantage in approach compared solution proposed earlier sublayout() , paint() methods called twice.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -