Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8349295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:57:09+00:00 2026-06-09T07:57:09+00:00

I am trying to implement a Wait Screen in my BlackBerry app. The screen

  • 0

I am trying to implement a “Wait Screen” in my BlackBerry app. The screen is to appear when the user clicks “Login” and it should go away after login has successfully been made. I am calling the screen in the “Login” listener after which I call a methd to fetch data from webs ervice. When the data is fetched, and the new screen is shown, the “Wait Screen” should disappear. However, on clicking login I get Uncaught - RuntimeException after which new screen is displayed with the “Waiting Screen” on top of it. Can somebody help me with this?

public class MessageScreen extends PopupScreen
{
    private String message;

    public MessageScreen (String message)
    {
        super( new HorizontalFieldManager(), Field.NON_FOCUSABLE);
        this.message = message;
        final BitmapField logo = new BitmapField(Bitmap.getBitmapResource( "cycle.gif"));
        logo.setSpace( 5, 5 );
        add(logo);

        RichTextField rtf = new RichTextField(message, Field.FIELD_VCENTER | Field.NON_FOCUSABLE | Field.FIELD_HCENTER);
        rtf.setEditable( false );

        add(rtf);
    }
}

I am calling this in the “Login” click event – button listener.

public void fieldChanged(Field field, int context)
{
    // Push appropriate screen depending on which button was clicked
    String uname = username.getText();
    String pwd = passwd.getText();
    if (uname.length() == 0 || pwd.length()==0) {
        Dialog.alert("One of the textfield is empty!");
    } else {
        C0NNECTION_EXTENSION=checkInternetConnection();
        if(C0NNECTION_EXTENSION==null)
        {
            Dialog.alert("Check internet connection and try again");
        }
        else
        {
            UiApplication.getUiApplication().invokeLater( new Runnable()
            {
                public void run ()
                {
                    UiApplication.getUiApplication().pushScreen( new MessageScreen("Signing in...") );
                }
            } );
            doLogin(uname, pwd);
        }
    }
}

private String doLogin(String user_id, String password)
{
    String URL ="";
    String METHOD_NAME = "ValidateCredentials";
    String NAMESPACE = "http://tempuri.org/";
    String SOAP_ACTION = NAMESPACE+METHOD_NAME;
    SoapObject resultRequestSOAP = null;
    HttpConnection httpConn = null;
    HttpTransport httpt;
    SoapPrimitive response = null;
    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
    request.addProperty("username", user_id);
    request.addProperty("password", password);
    System.out.println("The request is=======" + request.toString());
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.dotNet = true;
    envelope.setOutputSoapObject(request);
    httpt = new HttpTransport(URL+C0NNECTION_EXTENSION);
    httpt.debug = true;
    try
    {
        httpt.call(SOAP_ACTION, envelope);
        response = (SoapPrimitive) envelope.getResponse();
        String result =  response.toString();
        resultRequestSOAP = (SoapObject) envelope.bodyIn;
        String[] listResult = split(result, sep);
        strResult = listResult[0].toString();
        strsessionFirstName = listResult[1].toString();
        strsessionLastName = listResult[2].toString();
        strsessionPictureUrl = MAINURL + listResult[3].substring(2);
        strsessionStatusId = listResult[4].toString();
        strsessionStatusMessage = listResult[5].toString();
        strsessionLastUpdateTst = listResult[6].toString();

        if(strResult.equals("credentialaccepted"))
        {
            if(checkBox1.getChecked() == true)
            {
                persistentHashtable.put("username", user_id);
                persistentHashtable.put("password", password);
            }
            Bitmap bitmap = getLiveImage(strsessionPictureUrl, 140, 140);
            StatusActivity nextScreen = new StatusActivity();
            nextScreen.getUsername(user_id);
            nextScreen.getPassword(password);
            nextScreen.setPictureUrl(bitmap);
            nextScreen.setImage(strsessionPictureUrl);
            nextScreen.setFirstName(strsessionFirstName, strsessionLastName, strsessionLastUpdateTst, strsessionStatusMessage);
            UiApplication.getUiApplication().pushScreen(nextScreen);
            UiApplication.getUiApplication().invokeLater( new Runnable()
            {
                public void run ()
                {
                    UiApplication.getUiApplication().pushScreen( UiApplication.getUiApplication().getActiveScreen() );
                }
            } );
        }
        if(strResult.equals("credentialdenied"))
        {
            Dialog.alert("Invalid login details.");
            UiApplication.getUiApplication().pushScreen(new LoginTestScreen() );
        }
    } catch (IOException e) {
        // TODO Auto-generated catch block
        System.out.println("The exception is IO==" + e.getMessage());
    } catch (XmlPullParserException e) {
        // TODO Auto-generated catch block
        System.out.println("The exception xml parser example==="
        + e.getMessage());
    }

    System.out.println( resultRequestSOAP);
    //UiApplication.getUiApplication().pushScreen( UiApplication.getUiApplication().getActiveScreen() );
    return response + "";

    //UiApplication.getUiApplication().pushScreen(new InfoScreen());
    //Open a new Screen
} 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:57:10+00:00Added an answer on June 9, 2026 at 7:57 am

    Like Eugen said, you should run doLogin() on a background Thread:

    final String uname = username.getText();
    final String pwd = passwd.getText();
    
    Thread backgroundWorker = new Thread(new Runnable() {
        public void run() {
            doLogin(uname, pwd);
        }
    });
    
    backgroundWorker.start();
    

    If you do that, you’ll need to use UiApplication.invokeLater() (or another similar technique) to show your screens (back on the main/UI thread). You can’t leave the doLogin() method exactly as it originally was, because it makes calls to change the UI. For example, you have a couple calls to directly use pushScreen(), which should not be called (directly) from the background.

    This is not ok (from the background):

            UiApplication.getUiApplication().pushScreen(nextScreen);
    

    But, this is:

            UiApplication.getUiApplication().invokeLater( new Runnable()
            {
                public void run ()
                {
                    UiApplication.getUiApplication().pushScreen(nextScreen);
                }
            } );
    

    But, also, what is this code supposed to do? :

            UiApplication.getUiApplication().pushScreen(nextScreen);
            UiApplication.getUiApplication().invokeLater( new Runnable()
            {
                public void run ()
                {
                    UiApplication.getUiApplication().pushScreen( UiApplication.getUiApplication().getActiveScreen() );
                }
            } );
    

    This doesn’t make sense to me. What are you trying to do with those lines of code?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to implement LoaderManager + CursorLoader. In onFinish method adapter should swap its cursor
Trying to implement google C2DM service. registrationIntent.putExtra(app, PendingIntent.getBroadcast(context,0,new Intent(), 0)); registrationIntent.putExtra(sender,example@gmail.com); context.startService(registrationIntent); Almost every
Trying to implement a UITableView of names similar to the built-in Contacts iPhone app
I'm trying to implement the in App purchase mechanism in my iPhone app. To
I'm trying to implement some integration between a legacy app running in the Reflection
I am trying to implement a script that wait for a specific message in
Currently I am trying to implement a login validation system. I am using ajax
I'm trying implement A* Start path finding in my games(which are written with JavaScript,
I am trying implement a most recent widget into my tumblr post. So far,
Trying to implement a search similar to here .This searches properties based on city,locality,property

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.