本文整理汇总了Java中android.app.AlertDialog.Builder.setNegativeButton方法的典型用法代码示例。如果您正苦于以下问题:Java Builder.setNegativeButton方法的具体用法?Java Builder.setNegativeButton怎么用?Java Builder.setNegativeButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.AlertDialog.Builder
的用法示例。
在下文中一共展示了Builder.setNegativeButton方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例2: onCreateDialog
import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
protected Dialog onCreateDialog(int id) {
if (id == 0) {
Builder builder = new AlertDialog.Builder(this).setIcon(R.drawable.ic_dialog_menu_generic).setTitle(
R.string.pref_about);
View view = getLayoutInflater().inflate(R.layout.about, null);
TextView info = (TextView) view.findViewById(R.id.about_info);
info.setText(Html.fromHtml(getString(R.string.about_info, getVersionNumber(this))));
builder.setView(view);
builder.setNegativeButton(R.string.btn_close, new OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
return builder.create();
}
return null;
}
示例3: 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;
}
示例4: showAlert
import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
public static AlertDialog showAlert(final Context context, final int msgId, final int titleId, final DialogInterface.OnClickListener lOk, final DialogInterface.OnClickListener lCancel) {
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(titleId);
builder.setMessage(msgId);
builder.setPositiveButton(R.string.app_ok, lOk);
builder.setNegativeButton(R.string.app_cancel, lCancel);
// builder.setCancelable(false);
final AlertDialog alert = builder.create();
alert.show();
return alert;
}
示例5: 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());
}
示例6: 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();
}
示例7: 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();
}
示例8: onClick
import android.app.AlertDialog.Builder; //导入方法依赖的package包/类
@Override
public void onClick() {
if(getOnPreferenceClickListener()==null){
mCurrentDirectory =new File("/");
final EditText ed = new EditText(getContext());
ed.setText(getSharedPreferences().getString(getKey(), defaultBlocklist));
Builder b = new Builder(getContext());
b.setTitle(R.string.torrent_blocklist_url);
b.setView(ed);
b.setNegativeButton(android.R.string.cancel, null);
b.setPositiveButton(android.R.string.ok, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if(ed.getText().toString().isEmpty()){
showErrorDialog(getErrorString(-3));
return;
}
//trying to download
Uri uri = Uri.parse(ed.getText().toString());
String path = "";
String query = "";
try {
if(uri.getPath()!=null)
path= URLEncoder.encode(uri.getPath(), "UTF-8").replace("+", "%20").replace("%2F", "/");
if(uri.getQuery()!=null){
for(String param : uri.getQueryParameterNames()){
if(!query.isEmpty())
query+="&";
query+=URLEncoder.encode(param, "UTF-8")+"=";
query+=uri.getQueryParameter(param);
}
}
} catch (UnsupportedEncodingException e) {
return;
}
startDownload(uri.getScheme()+"://"+uri.getHost()+path+(!query.isEmpty()?"?"+query:""));
}
});
od =b.create();
od.show();
}
}