簡體   English   中英

我想在Android中從listview中檢索數據時顯示progressdialog的后台進程

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM