List of usage examples for android.app Activity onKeyDown
public boolean onKeyDown(int keyCode, KeyEvent event)
From source file:Main.java
public static ProgressDialog createProgressDialog(final Activity activity, int progressDialogTitleId, int progressDialogMsgId) { ProgressDialog progressDialog = new ProgressDialog(activity); if (progressDialogTitleId > 0) { progressDialog.setTitle(progressDialogTitleId); } else {/* w w w .j a v a2 s . c om*/ progressDialog.setTitle(activity.getResources().getIdentifier(PROGRESS_DIALOG_TITLE_RESOURCE, "string", activity.getPackageName())); } if (progressDialogMsgId > 0) { progressDialog.setMessage(activity.getString(progressDialogMsgId)); } else { progressDialogMsgId = activity.getResources().getIdentifier(PROGRESS_DIALOG_MESSAGE_RESOURCE, "string", activity.getPackageName()); progressDialog.setMessage(activity.getString(progressDialogMsgId)); } progressDialog.setIndeterminate(true); progressDialog.setOnKeyListener(new OnKeyListener() { public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { activity.onKeyDown(keyCode, event); return false; } }); // progressDialog.setInverseBackgroundForced(true); return progressDialog; }