Я создал асинхронную задачу и хочу изменить сообщение диалога прогресса на разных этапах doBackground. Вот код:
public class sc extends AsyncTask<Integer,String,Void>
{
ProgressDialog dialog;
protected void onPreExecute()
{
dialog=new ProgressDialog(Loc.this);
dialog.show();
}
@Override
protected Void doInBackground(Integer... params)
{
onProgressUpdate("Contacting server..Please wait..");
//Do some work
onProgressUpdate("Processing the result");
//Do some work
onProgressUpdate("Calculating..");
dialog.dismiss();
return null;
}
protected void onProgressUpdate(String ui)
{
dialog.setMessage(ui);
}
}
Но проблема в том, что диалог прогресса всегда показывает только первое сообщение. Пожалуйста, помогите мне найти решение.