我想从数据库中检索数据。所以我决定使用ProgressDialog
.
我想让用户在后台查看要添加到列表视图中的记录数。请帮我,
提前致谢..
使用如下所示的 AsyncTask 来显示 ProgressDialog
private class FetchRSSFeeds extends AsyncTask<String, Void, Boolean> {
private ProgressDialog dialog = new ProgressDialog(HomeActivity.this);
/** progress dialog to show user that the backup is processing. */
/** application context. */
protected void onPreExecute() {
this.dialog.setMessage("Please wait");
this.dialog.show();
}
protected Boolean doInBackground(final String... args) {
try {
/**
* Fetch the data
*/
Utilities.arrayRSS = objRSSFeed.FetchRSSFeeds(Constants.Feed_URL);
return true;
} catch (Exception e) {
Log.e("tag", "error", e);
return false;
}
}
@Override
protected void onPostExecute(final Boolean success) {
if (dialog.isShowing()) {
dialog.dismiss();
}
// Setting data to list adaptar
setListData();
txtTitle.setText(Utilities.RSSTitle);
}
}