Try this
new asyncTask(Your_context).execute();
private class asyncTask extends AsyncTask<Void, Void, Boolean>
{
Context context;
ProgressDialog pd;
asyncTask(Context context)
{
this.context = context;
pd = new ProgressDialog(activityContext);
}
protected void onPreExecute()
{
pd.setTitle("Loading..");
pd.setMessage("Please wait ...");
pd.setCancelable(false);
pd.show();
}
protected void onPostExecute(Boolean result)
{
// Update your UI.
if(pd.isShowing()) pd.dismiss();
}
@Override
protected Boolean doInBackground(Void... params)
{
// Get all data from web.
}
@Override
protected void onProgressUpdate(String... values)
{
super.onProgressUpdate(values);
pd.setMessage("Please Wait..." + values[0].toString());
}
public class Progress
{
public asyncTask task;
public Progress(asyncTask task)
{
this.task = task;
}
public void publish(String value)
{
task.publishProgress(value);
}
}
}
Try to call progress update with publishProgress(updating_values);