@Override protected void onPreExecute() { if (dialogShow) { progDialog = new ProgressDialog(RssReaderActivity.this); progDialog.setCancelable(false); progDialog.setMessage(getString(R.string.rss_fetching)); progDialog.setButton( DialogInterface.BUTTON_NEGATIVE, getString(R.string.btn_hide_text), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); Toast.makeText( RssReaderActivity.this, R.string.rss_keep_updating, Toast.LENGTH_SHORT) .show(); } }); progDialog.show(); } else Toast.makeText(RssReaderActivity.this, R.string.rss_start_updating, Toast.LENGTH_SHORT) .show(); isTaskRunning = true; }
protected Dialog onCreateDialog(int id) { switch (id) { case 0: mProgress = new ProgressDialog(this); mProgress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); mProgress.setTitle("Updating"); mProgress.setMessage("Wait..."); mProgress.setCancelable(false); mProgress.setButton( "Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { mQuit = true; dismissDialog(0); } }); return mProgress; } return null; }