onPreExecute AsyncTask を SherlockFragment に追加したいのですが、エラーが発生します。私のコードは以下です。preExecute AsyncTask にダイアログを追加するこのコードの問題は何ですか?
public class customlist extends SherlockFragment {
static final String URL = "esample";
static final String KEY_SONG = "song"; // parent node
private static final String KEY_TAB_NUM = "key.tab.num";
private ProgressDialog pDialog;
ListView list;
LazyAdapterbeth adapter;
XMLParser parser = new XMLParser();
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
new getFeed().execute();
}
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
View thisfragment = inflater.inflate(R.layout.dovomi, container, false);
return thisfragment;
}
private class getFeed extends AsyncTask<Void, Void, Document> {
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(customlist.this);
pDialog.setTitle("Connect to Server");
pDialog.setMessage("This process can take a few seconds to a few minutes, depending on your Internet Connection Speed.");
pDialog.setIndeterminate(false);
pDialog.setCancelable(false);
pDialog.show();
}
protected Document doInBackground(Void... params) {
XMLParser parser = new XMLParser();
String xml = parser.getXmlFromUrl(URL); // getting XML from URL
Document doc = parser.getDomElement(xml); // getting DOM element
return doc;
}
行でエラーが発生します
pDialog = new ProgressDialog(customlist.this);
このフラグメントにダイアログまたはプログレスバーを追加するにはどうすればよいですか?