Skip to content Skip to sidebar Skip to footer

Progressbar Betweed Activities

I have two activities. The first one executes the second one. Intent i = new Intent(MyOne.this, MyTwo.class); startActivity(i); The problem: My second activit

Solution 1:

I suggest you to do this asynchronously using AsyncTask.

Short example:

ProgressDialog dialog;
classYourTaskextendsAsyncTask<Void, Void, Void> {
        protectedvoidonPreExecute() {
                   dialog = ProgressDialog.show(...);
        }

        protectedVoiddoInBackground(Void... unused) {
            try {
               // doSomethingHeavy();// publishProgress(...);
            } catch(Exception e) {
                //...
            } 

            returnnull;
        }

        protectedvoidonProgressUpdate(Void... unused) {
        }

        protectedvoidonPostExecute(Void unused) {
            dialog.dismiss();

        }
    }

Solution 2:

Post a Comment for "Progressbar Betweed Activities"