Java Code Examples for android.app.ProgressDialog#setOwnerActivity()

The following examples show how to use android.app.ProgressDialog#setOwnerActivity() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImageLoad4BigTask.java    From YiBo with Apache License 2.0 6 votes vote down vote up
@Override
protected void onPreExecute() {
	super.onPreExecute();
	try {
		progressDialog = new ProgressDialog(context); 
		progressDialog.setMessage(context.getString(R.string.msg_big_image_loading));
		progressDialog.setCancelable(true);
		progressDialog.setOnCancelListener(onCancelListener);
		progressDialog.setOwnerActivity(context);
		progressDialog.setMax(100);
		progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
		progressDialog.show();
		if (isHit) {
	        cancel(true);
	        onPostExecute(null);
		}
	} catch (BadTokenException e) {
		if (Logger.isDebug()) {
			Log.d(LOG_TAG, e.getMessage(), e);
		}
		cancel(true);
	}

}
 
Example 2
Source File: ToolsDownloader.java    From Beats with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void showDownloadBar() {
	downloadBar = new ProgressDialog(this);
	downloadBar.setCancelable(false);
	downloadBar.setMessage(
			Tools.getString(R.string.ToolsDownloader_downloading) + url
			);
	downloadBar.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
	downloadBar.setProgress(0);
	downloadBar.setOwnerActivity(this);
	downloadBar.show();
}
 
Example 3
Source File: ToolsSampleInstaller.java    From Beats with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void extract() {
	/*
	DialogInterface.OnClickListener extract_action = new DialogInterface.OnClickListener() {
		public void onClick(DialogInterface dialog, int id) {
			Tools.track("Extract samples");
			extractSampleZip();
			dialog.cancel();
		}
	};

	Tools.alert(
			Tools.getString(R.string.Button_install),
			R.drawable.icon_zip,
			Tools.getString(R.string.ToolsUnzipper_install_ask) +
			Tools.getString(R.string.Tools_sample_zip) +
			Tools.getString(R.string.ToolsUnzipper_install_ask_location) +
			Tools.getSongsDir(),
			Tools.getString(R.string.Button_yes),
			extract_action,
			Tools.getString(R.string.Button_no),
			Tools.cancel_action,
			-1
			);
	*/
	extractingBar =	new ProgressDialog(a);
	extractingBar.setCancelable(false);
	extractingBar.setMessage(
			Tools.getString(message)
			);
	extractingBar.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
	extractingBar.setOwnerActivity(a);
	extractingBar.show();
	
	extracthandler = new Handler() {
		public void handleMessage(Message msg) {
			try {
				if (extractingBar != null) extractingBar.dismiss();
			} catch (IllegalArgumentException e) {
				ToolsTracker.error("ToolsSampleInstaller.handleMessage", e, path);
				if (Tools.getBooleanSetting(R.string.debugLogCat, R.string.debugLogCatDefault)) {
					Tools.toast(Tools.getString(R.string.Tools_window_error));
				}
			}
			if (success) {
				new ToolsUnzipper(a, path, true).unzip();
			} else {
				Tools.error(
						errorMsg,
						Tools.cancel_action
						);
			}
		}
	};
	
	// Just extract anyway without prompt
	new Thread(this).start();
}