下面是 XmlAdapters 示例代码。当我添加如下所示的 ProgressDialog 时收到错误“适配器类型中的方法 loadCursorAdapter(Context, int, String, Object...) 不适用于参数 (new AsyncTask(){}, int, String)”
final ProgressDialog _progressDialog = new ProgressDialog(this);
_progressDialog.setTitle("Loading ...");
_progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
new AsyncTask<Void, Void, Void>() {
protected Void doInBackground(Void ... urls) {
setContentView(R.layout.photos_list);
setListAdapter(Adapters.loadCursorAdapter(this, R.xml.photos,
"content://xmldocument/?url=" + Uri.encode("http://picasaweb.google.com/data/feed/api/featured?max-results=50&thumbsize=144c")));
}
protected void onPostExecute(Void result) {
_progressDialog.dismiss();
}
protected void onPreExecute(Void no) {
_progressDialog.show();
}
}.execute();