[英]I want to show the background process of progressdialog when retriving data from listview in Android
我想從數據庫中檢索數據。 所以我決定使用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);
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.