本文整理了Java中android.app.ProgressDialog.setOnKeyListener()
方法的一些代码示例,展示了ProgressDialog.setOnKeyListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ProgressDialog.setOnKeyListener()
方法的具体详情如下:
包路径:android.app.ProgressDialog
类名称:ProgressDialog
方法名:setOnKeyListener
暂无
代码示例来源:origin: 296777513/pedometer
@Override
public void run() {
progressDialog.setMessage(message);
progressDialog.setCancelable(false);
progressDialog.show();
progressDialog.setOnKeyListener(keyListener);
}
});
代码示例来源:origin: 296777513/pedometer
@Override
public void run() {
progressDialog.setMessage(message);
progressDialog.setCancelable(false);
progressDialog.show();
progressDialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) && (progressDialog.isShowing())) {
progressDialog.dismiss();
return true;
}
return false;
}
});
}
});
代码示例来源:origin: stackoverflow.com
private OnClickListener showDialog = new OnClickListener() {
@Override
public void onClick(View v) {
ProgressDialog progressDialog = new ProgressDialog(context);
progressDialog.setOnKeyListener(new OnKeyListener(){
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_SEARCH) {
Log.d("onKeyDown", "search key pressed");
return true;
}
return super.onKey(dialog,keyCode,event);
}});
progressDialog.show();
}
};
代码示例来源:origin: stackoverflow.com
public static ProgressDialog progress(Context context, String msg, boolean isCancelable) throws Exception {
try {
final ProgressDialog mProgressDialog = new ProgressDialog(context);
mProgressDialog.setMessage(msg);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
mProgressDialog.setCancelable(isCancelable);
mProgressDialog.setCanceledOnTouchOutside(isCancelable);
mProgressDialog.show();
mProgressDialog.setOnKeyListener(new OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
mProgressDialog.dismiss();
}
return false;
}
});
return mProgressDialog;
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
代码示例来源:origin: stackoverflow.com
progressDialog.setMessage(StringConstants.PROGRESS_DIALOG_MSG);
progressDialog.setCancelable(false);
progressDialog.setOnKeyListener(new OnKeyListener(){
@Override
public boolean onKey(DialogInterface dialog, int keyCode,
progressDialog.setMessage(StringConstants.PROGRESS_DIALOG_MSG);
progressDialog.setCancelable(false);
progressDialog.setOnKeyListener(new OnKeyListener(){
@Override
public boolean onKey(DialogInterface dialog, int keyCode,
代码示例来源:origin: stackoverflow.com
public static ProgressDialog createProgressDialog(final Activity activity,
int progressDialogTitleId, int progressDialogMsgId) {
ProgressDialog progressDialog = new ProgressDialog(activity);
if (progressDialogTitleId <= 0) {
progressDialogTitleId = activity.getResources().getIdentifier(
PROGRESS_DIALOG_TITLE_RESOURCE, "string", activity.getPackageName());
}
progressDialog.setTitle(progressDialogTitleId);
if (progressDialogMsgId <= 0) {
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;
}
});
代码示例来源:origin: cookpad/issue-reporter-android
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Bundle args = getArguments();
int messageId = args.getInt(EXTRA_MESSAGE);
String message = getString(messageId);
ProgressDialog progressDialog = new ProgressDialog(getActivity());
progressDialog.setMessage(message);
progressDialog.setCancelable(false);
progressDialog.setCanceledOnTouchOutside(false);
progressDialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
return keyCode == KeyEvent.KEYCODE_BACK;
}
});
return progressDialog;
}
}
内容来源于网络,如有侵权,请联系作者删除!