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
Developer
Petruchodd
Posts: 39
Registered: ‎10-19-2010
My Device: drova 9700
Accepted Solution

synchronized (Application.getEventLock()) freezing my app on new devices BB 6 (for example 9800 )

[ Edited ]

Hello guys.  please see my code  :

 

 public void run_my_thread()
 {
	
    myThread = new Thread(new Runnable()
     {
  	   public void run()
  	   {
  		   try {
  			    synchronized (Application.getEventLock()) {
  				  
  	 
  				    browserContent.finishLoading();
  				 
  				   
  			 	}
  			} catch (RenderingException e) {
  				// TODO Auto-generated catch block
  			//	Dialog.alert("blyat "+e.getMessage());
  			} 
  			catch (Exception es)
  			{
  			//	Dialog.alert(""+es.getMessage());
  				
  			}
  			return; 
  	   }
  	   
     });

	 myThread.start(); 

 }

 Can any one help me to fix this problem ? if i running this on emulators/devices <6 ( 9800) than all good. I don't have error or something . But when i running on emulator  Blackberry 6.0.0.141  9800 than my app are freezing . I know - it's realy problem in 

 synchronized (Application.getEventLock())

 but i don't know how to fix this :smileysad:((

 

also  i found a similar  problem http://supportforums.blackberry.com/t5/Java-Development/browserContent-finishLoading-hangs-on-OS-ver...

but there  are not found solution for my problem . Because need using browserContent - not browserFIeld. <-- this work only for v6 but how about <6 ??  so if any one know how to fix please tell mee. 

 

Please help me. 

Regards, Peter. 

p.s. hope u understand me , sorry for my bad english

Please use plain text.
Developer
simon_hain
Posts: 15,876
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: synchronized (Application.getEventLock()) freezing my app on new devices BB 6 (for example 9800 )

remove the synchronized block
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
Petruchodd
Posts: 39
Registered: ‎10-19-2010
My Device: drova 9700

Re: synchronized (Application.getEventLock()) freezing my app on new devices BB 6 (for example 9800 )

it's not working , yes app not freezing - but not showing content from browser!

Please use plain text.
Developer
simon_hain
Posts: 15,876
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: synchronized (Application.getEventLock()) freezing my app on new devices BB 6 (for example 9800 )

the javadoc says:
This method must not be invoked on a UI Event Dispatch Thread.

and if you sync on the eventlock you do exactly this.

where is the code where you add the field to your screen?

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
Petruchodd
Posts: 39
Registered: ‎10-19-2010
My Device: drova 9700

Re: synchronized (Application.getEventLock()) freezing my app on new devices BB 6 (for example 9800 )

[ Edited ]
RenderingSession _renderingSession = RenderingSession.getNewInstance();
		_renderingSession.getRenderingOptions();
		 
        _renderingSession.getRenderingOptions().setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.SHOW_IMAGES_IN_HTML, true);
		
		try 
		{	
			connection =(HttpConnection)Connector.open(url);
		    browserContent = _renderingSession.getBrowserContent(connection, this,e.EVENT_SET_HEADER);
		    if (browserContent != null) 
		    	{
					fieldbrowser = browserContent.getDisplayableContent();
			 	synchronized (app.getEventLock()) 
			 	{
						//mapp.deleteAll();
						
						browman.add(fieldbrowser);
						mapp.add(browman); 
						//mapp.add(fieldbrowser);
				 	}
				}
		 
			 } 
		
		catch (RenderingException e1) 
		{
			 
			e1.printStackTrace();
		} catch (IOException ee) {
			// TODO Auto-generated catch block
			ee.printStackTrace();
		}
 

 browman - verticalFieldManager.

fieldBrowser - just "Field"

MainScreen mapp;

Please use plain text.
Developer
Petruchodd
Posts: 39
Registered: ‎10-19-2010
My Device: drova 9700

Re: synchronized (Application.getEventLock()) freezing my app on new devices BB 6 (for example 9800 )

ok,, i think i solved this problem as u sayd  ... problem was in synchronized . So i removed this from my code- and tested on  emulators 5.0 , 6.0  .. still working . Hope it's realy worked. Thank dude.

Please use plain text.