以下に記述されているメソッドは、progressDialog(単なるスピナー)を表示するために使用されます。
setCancelableとsetIndeterminateをfalseに設定しました。これは、ユーザーにこのprogressDailogを閉じてほしくないためです。私の問題は、AsyncTaskのこのprogressDialog upoun完了を閉じる方法がわからないことです。助けてください、私は同じことを解決するために何時間もグーグルしていて、多くの同様の質問を見ましたが、これらのどれも私の問題を解決しませんでした!!
public class ListFriends extends ListActivity {
int intStat;
private static final int HOME = 0;
private static final int ADD = 1;
private static final int LOGOUT = 2;
private static final int SETTINGS = 3;
//private String friend;
private String user;
private String deviceUser;
private String friendNameGlobal;
....
....
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
........
........
loadFromServer(user);
}
private void loadFromServer(String userReceived) {
//buildToast("Please Wait while Updating The List");
showProgress();
String URL = "http://"+server+"/friendlistmob.php?userid="+userReceived;
new DownloadXmlTask().execute(URL);
}
private class DownloadXmlTask extends AsyncTask<String, Void, String> {
.....
.....
}
protected void onPostExecute(String result) {
progressDialog.dismiss();//not working
}
....
....
public void showProgress()
{
ProgressDialog progressDialog = new ProgressDialog(this);
progressDialog.setCancelable(false);
progressDialog.setIndeterminate(false);
progressDialog.setMessage("Please Wait while updating List");
progressDialog.show();
}
}