views:

226

answers:

1

hi group This may be a simple question but i am a beginner ,i need your suggestion on this. i have two Activities A1 and A2 .When i click the image on A1 screen i have to display progress bar until A2 screen appears(A2 activity has huge task to do).I tried

 image.setOnClickListener(new ImageView.OnClickListener() {

            public void onClick(View v)
            {

             myProgressDialog = ProgressDialog.show(A1.this,     
                        "Please wait...", "Loading...", true);

              new Thread() {
                   public void run() {
                        try{



                        Intent i = new Intent(A1.this,.A2.class);
                        startActivity(i);


                        } catch (Exception e) {  }
                        // Dismiss the Dialog
                        myProgressDialog.dismiss();
                   }
              }.start();


             }
        });

This couldn't display progress bar .I know that i am making a mistake but i couldn't figure out

+2  A: 

Your best bet is to show the progress dialog in the A2 activity. Once you start an Activity, the previous activity goes into the background, so the progress dialog wouldn't display anyway.

BrennaSoft