当前位置: 首页>>代码示例>>Java>>正文


Java AlertDialog.setMessage方法代码示例

本文整理汇总了Java中android.app.AlertDialog.setMessage方法的典型用法代码示例。如果您正苦于以下问题:Java AlertDialog.setMessage方法的具体用法?Java AlertDialog.setMessage怎么用?Java AlertDialog.setMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.app.AlertDialog的用法示例。


在下文中一共展示了AlertDialog.setMessage方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onEnterStartedState

import android.app.AlertDialog; //导入方法依赖的package包/类
private void onEnterStartedState() {
    Log.d(TAG, "call onEnterStartedState");
    /* Connect camera */
    if (!connectCamera(getWidth(), getHeight())) {
        AlertDialog ad = new AlertDialog.Builder(getContext()).create();
        ad.setCancelable(false); // This blocks the 'BACK' button
        ad.setMessage("It seems that you device does not support camera (or it is locked). Application will be closed.");
        ad.setButton(DialogInterface.BUTTON_NEUTRAL,  "OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                ((Activity) getContext()).finish();
            }
        });
        ad.show();

    }
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:18,代码来源:CameraBridgeViewBase.java

示例2: commonAlertDialog

import android.app.AlertDialog; //导入方法依赖的package包/类
public static void commonAlertDialog(Context parent, String title, String message) {

        AlertDialog alertDialog = new AlertDialog.Builder(parent, AlertDialog.THEME_HOLO_DARK).create();
        alertDialog.setTitle(title);

        alertDialog.setMessage(Html.fromHtml(message));
        alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                }
        );

        alertDialog.show();
    }
 
开发者ID:Samsung,项目名称:microbit,代码行数:17,代码来源:CommonGUI.java

示例3: onBackPressed

import android.app.AlertDialog; //导入方法依赖的package包/类
@Override
public void onBackPressed() {
	if (core != null && core.hasChanges()) {
		DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int which) {
				if (which == AlertDialog.BUTTON_POSITIVE)
					core.save();

				finish();
			}
		};
		AlertDialog alert = mAlertBuilder.create();
		alert.setTitle("MuPDF");
		alert.setMessage(getString(R.string.document_has_changes_save_them_));
		alert.setButton(AlertDialog.BUTTON_POSITIVE, getString(R.string.yes), listener);
		alert.setButton(AlertDialog.BUTTON_NEGATIVE, getString(R.string.no), listener);
		alert.show();
	} else {
		super.onBackPressed();
	}
}
 
开发者ID:ArtifexSoftware,项目名称:mupdf-android-viewer-old,代码行数:22,代码来源:MuPDFActivity.java

示例4: showAlertDialog

import android.app.AlertDialog; //导入方法依赖的package包/类
public void showAlertDialog(Context context, String title, String message,
                            Boolean status) {
    AlertDialog alertDialog = new AlertDialog.Builder(context).create();
    alertDialog.setTitle(title);
    alertDialog.setMessage(message);
    if(status != null)
        alertDialog.setIcon((status) ? R.drawable.success : R.drawable.fail);
        alertDialog.setButton("Тийм", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
        }
    });
    alertDialog.show();
}
 
开发者ID:tortuvshin,项目名称:actions,代码行数:14,代码来源:AlertDialogManager.java

示例5: onEnterStartedState

import android.app.AlertDialog; //导入方法依赖的package包/类
private void onEnterStartedState() {
    /* Connect camera */
    if (!connectCamera(getWidth(), getHeight())) {
        AlertDialog ad = new AlertDialog.Builder(getContext()).create();
        ad.setCancelable(false); // This blocks the 'BACK' button
        ad.setMessage("It seems that you device does not support camera (or it is locked). Application will be closed.");
        ad.setButton(DialogInterface.BUTTON_NEUTRAL,  "OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                ((Activity) getContext()).finish();
            }
        });
        ad.show();

    }
}
 
开发者ID:Deeplocal,项目名称:android-things-drawbot,代码行数:17,代码来源:CameraBridgeViewBase.java

示例6: onRequestPermissionsResult

import android.app.AlertDialog; //导入方法依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[],
                                       @NonNull int[] grantResults) {
    switch (requestCode) {
        case RECORD_AUDIO_PERMISSION: {
            if (grantResults.length > 0
                    && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                startRecording();
            } else {
                AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create();
                alertDialog.setTitle(R.string.permission_required);
                alertDialog.setMessage("Microphone permission is required. App will be closed");
                alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                                dialog.dismiss();
                                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                                    finishAffinity();
                                } else {
                                    finish();
                                }
                            }
                        });
                alertDialog.show();
            }
        }
    }
}
 
开发者ID:gstraube,项目名称:cythara,代码行数:29,代码来源:MainActivity.java

示例7: onRequestPermissionsResult

import android.app.AlertDialog; //导入方法依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode,
                                       String permissions[], int[] grantResults) {
    switch (requestCode) {
        case MY_PERMISSIONS_REQUEST_LOCATION: {
            // If request is cancelled, the result arrays are empty.
            if (grantResults.length > 0
                    && grantResults[0] == PackageManager.PERMISSION_GRANTED) {

                // permission was granted
                if (ContextCompat.checkSelfPermission(this,
                        android.Manifest.permission.ACCESS_FINE_LOCATION)
                        == PackageManager.PERMISSION_GRANTED) {
                    if (mGoogleApiClient == null) {
                        buildGoogleApiClient();
                    }
                    mMap.setMyLocationEnabled(true);
                }
            } else {
                // Permission denied, show alert
                AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create();
                alertDialog.setTitle("Alert");
                alertDialog.setMessage("Please allow the location permission!");
                alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                                dialog.dismiss();
                                checkLocationPermission();
                            }
                        });
                alertDialog.show();
            }
            return;
        }
    }
}
 
开发者ID:armendu,项目名称:traffic-report-android,代码行数:37,代码来源:MainActivity.java

示例8: onPrepareDialog

import android.app.AlertDialog; //导入方法依赖的package包/类
@Override
public void onPrepareDialog(int dialogId, @NonNull Dialog dialog) {
    AlertDialog alert = (AlertDialog) dialog;
    switch (dialogId) {
        case DIALOG_CONFIRM: {
            int messageCount = messagesToDelete.size();
            alert.setMessage(getResources().getQuantityString(
                    R.plurals.dialog_confirm_delete_messages, messageCount, messageCount));
            break;
        }
    }

    super.onPrepareDialog(dialogId, dialog);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:15,代码来源:NotificationDeleteConfirmation.java

示例9: showAlertDialog

import android.app.AlertDialog; //导入方法依赖的package包/类
private void showAlertDialog(String message) {
    AlertDialog alertDialog = new AlertDialog.Builder(this).create();
    alertDialog.setTitle("Alert");
    alertDialog.setMessage(message);
    alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK",
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            });
    alertDialog.show();
}
 
开发者ID:freeloki,项目名称:AndroidThings-BurglarAlarm,代码行数:13,代码来源:BurglarActivity.java

示例10: showAlert

import android.app.AlertDialog; //导入方法依赖的package包/类
/**
 * 展示一个通用的弹出框UI
 *
 * @param context 展示弹出框的上下文环境
 * @param title   警告的title信息
 * @param text    警告信息
 */
public static void showAlert(Context context, String title, String text) {
    AlertDialog alertDialog = new Builder(context).create();
    alertDialog.setTitle(title);
    alertDialog.setMessage(text);
    alertDialog.setCanceledOnTouchOutside(true);
    alertDialog.show();
}
 
开发者ID:dueros,项目名称:dcs-sdk-java,代码行数:15,代码来源:CommonUtil.java

示例11: showError

import android.app.AlertDialog; //导入方法依赖的package包/类
/**
 * Shows an error message.
 * 
 * @param context
 *            {@link Context}
 * @param msg
 *            the message.
 * @param listener
 *            will be called after the user cancelled the dialog.
 */
public static void showError(Context context, CharSequence msg,
        DialogInterface.OnCancelListener listener) {
    AlertDialog dlg = newAlertDlg(context);
    dlg.setIcon(android.R.drawable.ic_dialog_alert);
    dlg.setTitle(R.string.afc_title_error);
    dlg.setMessage(msg);
    dlg.setOnCancelListener(listener);
    dlg.show();
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:20,代码来源:Dlg.java


注:本文中的android.app.AlertDialog.setMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。