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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Trusted Contributor
jaff
Posts: 115
Registered: ‎11-16-2011
My Carrier: 3
Accepted Solution

terminate when updating UI...

im create screen with paging... button load to add more data, is normal on os 6 and os 7... but in os 5 process terminated... i haved create on thread to update ui in invoke later...
it is my code in invoke later :

UiApplication.getUiApplication().invokeLater(
								new Runnable() {
									public void run() {
										// delete(hfmLoad);
										for (int i = 0; i < comp.length(); i++) {
											lowerScreen.add(list[i]);
											HorizontalFieldManager hfmBut = new HorizontalFieldManager(
													Field.FIELD_RIGHT);
											hfmBut.setMargin(0, 5, 0, 0);

											hfmBut.add(but1[i]);
											lowerScreen.add(hfmBut);

											spasi = new SeparatorField() {
												protected void paint(Graphics g) {
													g.setColor(Color.GRAY);
													int currentStipple = g
															.getStipple();

													try {
														g
																.setStipple(0xAAAAAAAA); // Dotted

														super.paint(g);

													} finally {

														g
																.setStipple(currentStipple);
													}
												}
											};
											spasi.setMargin(0, 5, 5, 5);
											lowerScreen.add(spasi);
											invalidate();
											//lowerScreen.add(new LabelField("Semangat",Field.FOCUSABLE));
										}
										
										hfmLoad
										.replace(_ourAnimation2, loadBut);
										invalidate();


									}

 any solution?

Please use plain text.
Developer
peter_strange
Posts: 17,958
Registered: ‎07-14-2008

Re: terminate when updating UI...

[ Edited ]

None of the invalidate() method calls are needed in this code.

 

For efficiency instead of adding the Field individually, I recommend that you use the addAll method.  In your loop, create an array of Fields to add, then use addAll to add the array.

 

If you do both of these things I suspect your problem will be resolved. 

 

But if not, can you please tell us exactly what messages you see when the process is terminated.   

 

 

Please use plain text.
Trusted Contributor
jaff
Posts: 115
Registered: ‎11-16-2011
My Carrier: 3

Re: terminate when updating UI...

thanks a lot peter... method addAll is the solution!

Please use plain text.