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


Java Builder.setPositiveButton方法代码示例

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


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

示例1: rapporterOgvisFejl

import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
public static void rapporterOgvisFejl(final Activity akt, final Exception e) {
  if (!App.EMULATOR) {
    Crashlytics.logException(e);
    //Mint.logException(e);
  }
  Log.e(e);

  Builder ab = new Builder(akt);
  ab.setTitle("Beklager, der skete en fejl");
  ab.setMessage(e.toString());
  ab.setNegativeButton("Fortsæt", null);
  ab.setPositiveButton("Indsend fejl", new Dialog.OnClickListener() {
    public void onClick(DialogInterface arg0, int arg1) {
      String brødtekst = "Skriv, hvad der skete:\n\n\n---\n";
      brødtekst += "\nFejlspor;\n" + android.util.Log.getStackTraceString(e);
      brødtekst += "\n\n" + lavKontaktinfo();
      App.kontakt(akt, "Fejl DR Radio", brødtekst, Log.log.toString());
    }

  });
  ab.create().show();
}
 
开发者ID:nordfalk,项目名称:EsperantoRadio,代码行数:23,代码来源:Log.java

示例2: showAlert

import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
public static AlertDialog showAlert(final Context context, final String msg, final String title) {
	if (context instanceof Activity && ((Activity) context).isFinishing()) {
		return null;
	}

	final Builder builder = new AlertDialog.Builder(context);
	builder.setIcon(R.drawable.ic_dialog_alert);
	builder.setTitle(title);
	builder.setMessage(msg);
	builder.setPositiveButton(R.string.app_ok, new DialogInterface.OnClickListener() {

		@Override
		public void onClick(final DialogInterface dialog, final int which) {
			dialog.cancel();
		}
	});
	final AlertDialog alert = builder.create();
	alert.show();
	return alert;
}
 
开发者ID:linsir6,项目名称:TripBuyer,代码行数:21,代码来源:MMAlert.java

示例3: createDialog

import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
public static Dialog createDialog(Context context, Bundle arguments, OnClickListener onClickListener) {
    Builder builder = new Builder(context);
    builder.setTitle(arguments.getString(ErrorDialogManager.KEY_TITLE));
    builder.setMessage(arguments.getString(ErrorDialogManager.KEY_MESSAGE));
    if (ERROR_DIALOG_ICON != 0) {
        builder.setIcon(ERROR_DIALOG_ICON);
    }
    builder.setPositiveButton(17039370, onClickListener);
    return builder.create();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:11,代码来源:ErrorDialogFragments.java

示例4: a

import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
public static Dialog a(Context context, String str, String str2, String str3, OnClickListener onClickListener, String str4, OnClickListener onClickListener2) {
    Builder builder = new Builder(context);
    if (a) {
        if (!(TextUtils.isEmpty(str4) || onClickListener2 == null)) {
            builder.setPositiveButton(str4, onClickListener2);
        }
        if (!(TextUtils.isEmpty(str3) || onClickListener == null)) {
            builder.setNegativeButton(str3, onClickListener);
        }
    } else {
        if (!(TextUtils.isEmpty(str3) || onClickListener == null)) {
            builder.setPositiveButton(str3, onClickListener);
        }
        if (!(TextUtils.isEmpty(str4) || onClickListener2 == null)) {
            builder.setNegativeButton(str4, onClickListener2);
        }
    }
    builder.setTitle(str);
    builder.setMessage(str2);
    Dialog create = builder.create();
    create.setCanceledOnTouchOutside(false);
    create.setOnKeyListener(new e());
    try {
        create.show();
    } catch (Throwable th) {
    }
    return create;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:29,代码来源:d.java

示例5: onPrepareDialogBuilder

import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
@Override
protected void onPrepareDialogBuilder(Builder builder) {

    // do again, maybe an app has now been installed
    populateAppList();

    // Init ArrayAdapter with OpenPGP Providers
    ListAdapter adapter = new ArrayAdapter<OpenPgpProviderEntry>(getContext(),
            android.R.layout.select_dialog_singlechoice, android.R.id.text1, mList) {
        public View getView(int position, View convertView, ViewGroup parent) {
            // User super class to create the View
            View v = super.getView(position, convertView, parent);
            TextView tv = (TextView) v.findViewById(android.R.id.text1);

            // Put the image on the TextView
            tv.setCompoundDrawablesWithIntrinsicBounds(mList.get(position).icon, null,
                    null, null);

            // Add margin between image and text (support various screen densities)
            int dp10 = (int) (10 * getContext().getResources().getDisplayMetrics().density + 0.5f);
            tv.setCompoundDrawablePadding(dp10);

            return v;
        }
    };

    builder.setSingleChoiceItems(adapter, getIndexOfProviderList(mSelectedPackage),
            new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    OpenPgpProviderEntry entry = mList.get(which);

                    if (entry.intent != null) {
                        /*
                         * Intents are called as activity
                         *
                         * Current approach is to assume the user installed the app.
                         * If he does not, the selected package is not valid.
                         *
                         * However  applications should always consider this could happen,
                         * as the user might remove the currently used OpenPGP app.
                         */
                        getContext().startActivity(entry.intent);
                        return;
                    }

                    mSelectedPackage = entry.packageName;

                    /*
                     * Clicking on an item simulates the positive button click, and dismisses
                     * the dialog.
                     */
                    OpenPgpAppPreference.this.onClick(dialog, DialogInterface.BUTTON_POSITIVE);
                    dialog.dismiss();
                }
            });

    /*
     * The typical interaction for list-based dialogs is to have click-on-an-item dismiss the
     * dialog instead of the user having to press 'Ok'.
     */
    builder.setPositiveButton(null, null);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:65,代码来源:OpenPgpAppPreference.java

示例6: showDeleteHistoryConfirmation

import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
private void showDeleteHistoryConfirmation() {
    Builder builder = new Builder(getParentActivity());
    builder.setMessage(LocaleController.getString("AreYouSureDeleteChanges", R.string.AreYouSureDeleteChanges));
    builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
    builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new C20941());
    builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
    showDialog(builder.create());
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:9,代码来源:UpdateActivity.java

示例7: run

import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
@Override
public void run() {
    Builder builder = new Builder(InCallActivity.this);
    Resources r = getResources();
    builder.setTitle("ZRTP supported by remote party");
    builder.setMessage("Do you confirm the SAS : " + sasString);
    builder.setPositiveButton(r.getString(R.string.yes), this);
    builder.setNegativeButton(r.getString(R.string.no), this);

    AlertDialog backupDialog = builder.create();
    backupDialog.show();
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:13,代码来源:InCallActivity.java

示例8: showDialog

import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
public static void showDialog(Activity context, String strTitle, String strText, int icon) {
    if (context != null && !context.isFinishing() && !context.isRestricted()) {
        Builder tDialog = new Builder(context);
        tDialog.setIcon(icon);
        tDialog.setTitle(strTitle);
        tDialog.setMessage(strText);
        tDialog.setPositiveButton(R.string.Ensure, null);
        try {
            tDialog.show();
        } catch (Exception e) {
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:14,代码来源:BaseHelper.java

示例9: createDialog

import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
private Dialog createDialog(int titleId, int textId, boolean twoButtons) {
	Builder builder = new AlertDialog.Builder(this).setIcon(R.drawable.ic_dialog_menu_generic).setTitle(titleId)
			.setMessage(textId);
	if (twoButtons) {
		builder.setPositiveButton(R.string.btn_accept, this);
		builder.setNegativeButton(R.string.btn_calcel, this);
	} else {
		builder.setNeutralButton(R.string.btn_close, this);
	}
	return builder.create();
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:12,代码来源:CommonPrefs.java

示例10: showError

import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
/**
 * Show a visual error message to the user.
 * 
 * @param message
 *          the message to show
 */
private void showError(String message) {
  final Builder builder = new AlertDialog.Builder(AlbumListActivity.this);
  builder.setTitle(message);
  builder.setIcon(android.R.drawable.ic_dialog_alert);
  builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
      dialog.dismiss();
    }
  });
  builder.setMessage(message);
  builder.show();

}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:21,代码来源:AlbumListActivity.java

示例11: onPrepareDialogBuilder

import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
@Override
protected void onPrepareDialogBuilder(Builder builder) {

    // do again, maybe an app has now been installed
    populateAppList();

    // Init ArrayAdapter with OpenPGP Providers
    ListAdapter adapter = new ArrayAdapter<OpenPgpProviderEntry>(getContext(),
            android.R.layout.select_dialog_singlechoice, android.R.id.text1, mList) {
        public View getView(int position, View convertView, ViewGroup parent) {
            // User super class to create the View
            View v = super.getView(position, convertView, parent);
            TextView tv = (TextView) v.findViewById(android.R.id.text1);

            // Put the image on the TextView
            tv.setCompoundDrawablesWithIntrinsicBounds(mList.get(position).icon, null,
                    null, null);

            // Add margin between image and text (support various screen densities)
            int dp10 = (int) (10 * getContext().getResources().getDisplayMetrics().density + 0.5f);
            tv.setCompoundDrawablePadding(dp10);

            return v;
        }
    };

    builder.setSingleChoiceItems(adapter, getIndexOfProviderList(mSelectedPackage),
            new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    OpenPgpProviderEntry entry = mList.get(which);

                    if (entry.intent != null) {
                        /*
                         * Intents are called as activity
                         *
                         * Current approach is to assume the user installed the app.
                         * If he does not, the selected package is not valid.
                         *
                         * However  applications should always consider this could happen,
                         * as the user might remove the currently used OpenPGP app.
                         */
                        getContext().startActivity(entry.intent);
                        return;
                    }

                    mSelectedPackage = entry.packageName;

                    /*
                     * Clicking on an item simulates the positive button click, and dismisses
                     * the dialog.
                     */
                    SMimeAppPreference.this.onClick(dialog, DialogInterface.BUTTON_POSITIVE);
                    dialog.dismiss();
                }
            });

    /*
     * The typical interaction for list-based dialogs is to have click-on-an-item dismiss the
     * dialog instead of the user having to press 'Ok'.
     */
    builder.setPositiveButton(null, null);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:65,代码来源:SMimeAppPreference.java


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