Asynctask中的onPostExecute方法未被調用,並且progressdialog未被取消。我也沒有得到任何例外。任何幫助,將不勝感激。
這裏是我的代碼無法關閉片段中的postexecute方法中的進度對話框
public class ParseAsync extends AsyncTask<String, Void, Void>
{
ProgressDialog pDialog = null;
@Override
protected void onPreExecute()
{
super.onPreExecute();
pDialog = ProgressDialog.show(getActivity(), "", "Loading.....", true, false);
}
@Override
protected Void doInBackground(String... params)
{
RSSFeedXMLParser parser = new RSSFeedXMLParser();
String urls = params[0];
parser.parsedata(urls);
return null;
}
@Override
protected void onPostExecute(Void result)
{
pDialog.dismiss();
listAdapter = new ListAdapter(getActivity());
lvnewsfeed.setAdapter(listAdapter);
}
}
我打電話oncreateview方法的AsyncTask是這樣的:
new ParseAsync().execute("rssfeedurl");
這工作,感謝傢伙 – Anirudh