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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Contributor
Posts: 14
Registered: ‎08-21-2011
My Device: Bold
My Carrier: Airtel

Non Blocking Http Connection

Have login screen, during authentication if my Wifi or 3G network goes down application remains unresponsive even I cant go to home screen by pressing hang-off button (red), only option is by pressing menu buttong to dispay switch over.Please advise..how to handle without blocking the UI

 

This is how handled..


private void connectToServer()
{
final PopupScreen pop1 = new SMProgress().getPopUp("Authentication In-progress...");
		//
		UiApplication.getUiApplication().invokeLater(new Runnable()
		{
			public void run()
			{
			
				UiApplication.getUiApplication().pushScreen(pop1);
				
			}
			
		});
		
		
		UiApplication.getUiApplication().invokeLater(new Runnable()
		{
			public void run()
			{
				disableUi();
			
				boolean t = doLogin(txtUN.getText(), txtPass.getText());
				
			    UiApplication.getUiApplication().popScreen(pop1);
				
				UiApplication.getUiApplication().repaint();
				if(t) {
					UiApplication.getUiApplication().pushScreen(new IndexScreen(LoginScreen.this));
				}
				else
				{
					
					enableUi();
// Authentication failed..
				}
				
				System.out.println(" AM DONE.... 2");
			}
			
		});
		
		
	} 
Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Non Blocking Http Connection

Looks to me like you are doing the login in the UI event thread. You'll need to put the HTTP in a separate worker thread.

 

The HTTP worker thread would then have to notify the UI with the result of the login.

 

Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: Non Blocking Http Connection

Move all your time consuming task to a separate thread...