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
New Developer
Posts: 17
Registered: ‎07-16-2012
My Device: None
My Carrier: None

Dialog indicating page is busy loading

[ Edited ]

Hi all,

 

I'm trying to do, a simple dialog pop up, to indicate to the user that the page is busy loading but freezes at

"UiApplication.getUiApplication().pushModalScreen(dialog);".

 

How do i go about fixing this?

 

FieldChangeListener listener = new FieldChangeListener() {
        public void fieldChanged(Field field, int context) {
        	Dialog dialog = new Dialog("Please wait while loading...", null, null, 0, null); UiApplication.getUiApplication().pushModalScreen(dialog);
        	
        	
			Authenticate auth = new Authenticate();
        	SoapObject object = auth.Connect(auth.AuthenticateBody(usernametxt.getText().trim(), passwordtxt.getText().trim()), "http://198.15.194.139:83/Webservice/Authentication.svc", "http://tempuri.org/IAuthentication/Authenticate");
        	String Success = object.getProperty("Success").toString().trim().toLowerCase();
        	String Token = object.getProperty("Token").toString();
        	
        	RuntimeStore store = RuntimeStore.getRuntimeStore();
        	
        	if(Success.equals("true")){
        		try {
        			store.put( TOKEN_ID, Token );
        			UiApplication.getUiApplication().pushScreen(new MainMenu());
            	}
        		catch(IllegalArgumentException e) {
        			
            	}
        	}
        	else{
        		//d.close();
        		Dialog.inform("Username or password is incorrect");
        	}
        }
    };

 

Highlighted
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Dialog indicating page is busy loading

I presume that you want to display that dialog and allow your processing to continue.

 

Unfortunately you sort of have to do this backwards, you have to start the background processing going, and the stall the UI processing on something like your Dialog.

 

There are a number of Threads on the forum that talk about this.  If you look for "Please Wait screen" or "Loading Screen", you will find more.

 

I also suggest you have a look at this:

http://supportforums.blackberry.com/t5/Java-Development/Sample-quot-Please-Wait-quot-screen-part-1/t...

 

And especially, read the comments at the end (you have to click on the comment link to see them).  There is updated code that I think matches your requirements. 

 

Let us know if this is not enough for you.