Reputation: 1636
In my project, I need to start a progress dialog
in one activity and need to stop it in an another activity. Here is my code.
progress.setMessage("Searching... ");
progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progress.setIndeterminate(true);
progress.show();
Intent intent = new Intent(mContext,BirdsAlgorithm.class );
intent.putExtras(bundle);
startActivity(intent);
I need to stop this progress bar in BirdsAlgorithm
class. How can I do this?
Upvotes: 1
Views: 729
Reputation: 231
You have two options:
make progress static and public and then in next activity access it through the class name and then stop it.
override on destroy and on stop method for activity and then on stop and on destroy stop your progress
Upvotes: 0
Reputation: 11776
The progress dialog runs on UI thread. So you should not do anything like this. Instead you can dismiss the progress and start a new instance of it in new Activity.
Upvotes: 1