當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。