androidx.appcompat.app.AlertDialog.setMessage()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(85)

本文整理了Java中androidx.appcompat.app.AlertDialog.setMessage()方法的一些代码示例,展示了AlertDialog.setMessage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AlertDialog.setMessage()方法的具体详情如下:
包路径:androidx.appcompat.app.AlertDialog
类名称:AlertDialog
方法名:setMessage

AlertDialog.setMessage介绍

暂无

代码示例

代码示例来源:origin: martykan/webTube

private void show_noVideo_dialog() {
  AlertDialog dialog = new AlertDialog.Builder(context/**/).create();
  dialog.setTitle(context.getString(R.string.error_no_video));
  dialog.setMessage(context.getString(R.string.error_select_video_and_retry));
  dialog.setCancelable(true);
  dialog.setButton(DialogInterface.BUTTON_POSITIVE, context.getString(android.R.string.ok).toUpperCase(),
      (dialog1, buttonId) -> dialog1.dismiss());
  dialog.show();
}

代码示例来源:origin: martykan/webTube

public void homepageTutorial() {
  if (!sp.getBoolean("homepageLearned", false)) {
    AlertDialog dialog = new AlertDialog.Builder(context).create();
    dialog.setTitle(context.getString(R.string.home));
    dialog.setMessage(context.getString(R.string.homePageHelp));
    dialog.setCancelable(false);
    dialog.setButton(DialogInterface.BUTTON_POSITIVE, "OK",
        (dialog1, buttonId) -> {
          dialog1.dismiss();
          SharedPreferences.Editor editor = sp.edit();
          editor.putBoolean("homepageLearned", true);
          editor.apply();
        });
    dialog.show();
  }
}

代码示例来源:origin: bfabiszewski/ulogger-android

/**
 * Set up basic dialog
 * @param context Context
 * @param title Title
 * @param message Message
 * @return AlertDialog Dialog
 */
private static AlertDialog initDialog(Context context, CharSequence title, CharSequence message) {
  AlertDialog alertDialog = new AlertDialog.Builder(context).create();
  alertDialog.setTitle(title);
  alertDialog.setMessage(message);
  return alertDialog;
}

代码示例来源:origin: linkedin/shaky-android

/**
   * Validates the message and returns true if the form is valid.
   */
  private boolean validate(@NonNull String message) {
    if (message.trim().length() == 0) {
      AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).create();
      alertDialog.setMessage(getString(R.string.shaky_empty_feedback_message));
      alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, getString(R.string.shaky_empty_feedback_confirm),
                 new DialogInterface.OnClickListener() {
                   public void onClick(DialogInterface dialog, int which) {
                     dialog.dismiss();
                   }
                 });
      alertDialog.show();
      return false;
    }

    return true;
  }
}

代码示例来源:origin: stripe/stripe-android

private void displayError(String errorMessage) {
  AlertDialog alertDialog = new AlertDialog.Builder(this).create();
  alertDialog.setTitle("Error");
  alertDialog.setMessage(errorMessage);
  alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK",
      new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
          dialog.dismiss();
        }
      });
  alertDialog.show();
}

代码示例来源:origin: martykan/webTube

AlertDialog alert = new AlertDialog.Builder(context).create();
alert.setTitle(context.getString(R.string.enableTor) + "?");
alert.setMessage(context.getString(R.string.torWarning));
alert.setCancelable(false);
alert.setButton(DialogInterface.BUTTON_POSITIVE, context.getString(R.string.enable),

相关文章