Reputation: 53
I am using Mysql online database in my android application and I am using BackgroundWorker class. I kindly ask how can I create like a loading progress bar or circular loading shape while the data is loading from the online database to the activity or fragment?
Upvotes: 0
Views: 32
Reputation:
create progressDialog in Your Activity or Fragment
and use your network library to get data from server. To use ProgressDialog use the below code
ProgressDialog progressdialog = new ProgressDialog(getApplicationContext());
progressdialog.setMessage("Please Wait....");
To start the ProgressDialog use
progressdialog.show();
progressdialog.setCancelable(false); //is used so that ProgressDialog cannot be cancelled until the work is done.
To stop the ProgressDialog use this code (when your work is finished):
progressdialog.dismiss();`
Upvotes: 1