Java 类android.app.AlertDialog.Builder 实例源码

项目:EsperantoRadio    文件:Log.java   
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();
}
项目:boohee_v5.6    文件:ErrorDialogFragments.java   
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();
}
项目:TripBuyer    文件:MMAlert.java   
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;
}
项目:TripBuyer    文件:MMAlert.java   
public static AlertDialog showAlert(final Context context, final int msgId, final int titleId) {
    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, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            dialog.cancel();
        }
    });
    final AlertDialog alert = builder.create();
    alert.show();
    return alert;
}
项目:ceji_android    文件:PromptManager.java   
/**
 * 当判断当前手机没有网络时使用
 * @param context
 */
public static void showNoNetWork(final Context context) {
    Builder builder = new Builder(context);
    builder.setIcon(R.mipmap.ic_launcher)//
            .setTitle(R.string.app_name)//
            .setMessage("当前无网络").setPositiveButton("设置", new OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // 跳转到系统的网络设置界面
                    Intent intent=new Intent();
                    intent.setClassName("com.android.settings", "com.android.settings.WirelessSettings");
                    context.startActivity(intent);

                }
            }).setNegativeButton("知道了", null).show();
}
项目:ceji_android    文件:PromptManager.java   
/**
 * 退出系统
 * @param context
 */
public static void showExitSystem(Context context) {
    Builder builder = new Builder(context);
    builder.setIcon(R.mipmap.ic_launcher)//
            .setTitle(R.string.app_name)//
            .setMessage("是否退出应用").setPositiveButton("确定", new OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    android.os.Process.killProcess(android.os.Process.myPid());
                    //多个Activity——懒人听书:没有彻底退出应用
                    //将所有用到的Activity都存起来,获取全部,干掉
                    //BaseActivity——onCreated——放到容器中
                }
            })//
            .setNegativeButton("取消", null)//
            .show();

}
项目:letv    文件:DialogUtil.java   
public static void call(Context activity, String title, String message, int yes, int no, OnClickListener yesListener, OnClickListener noListener, boolean cancelable) {
    if (activity != null) {
        Dialog dialog = new Builder(activity).setTitle(title).setIcon(R.drawable.dialog_icon).setMessage(message).setCancelable(cancelable).setPositiveButton(yes, yesListener).setNegativeButton(no, noListener).create();
        if ((activity instanceof Activity) && !((Activity) activity).isFinishing() && !activity.isRestricted()) {
            try {
                dialog.show();
            } catch (Exception e) {
            }
        }
    }
}
项目:letv    文件:DialogUtil.java   
public static void call(Activity activity, String messageId, OnClickListener yes, OnClickListener no) {
    if (activity != null) {
        Dialog dialog = new Builder(activity).setIcon(R.drawable.dialog_icon).setMessage(messageId).setPositiveButton(R.string.dialog_default_ok, yes).setNegativeButton(R.string.dialog_default_no, no).create();
        if (!activity.isFinishing() && !activity.isRestricted()) {
            try {
                dialog.show();
            } catch (Exception e) {
            }
        }
    }
}
项目:letv    文件:UIs.java   
public static void call(Context context, Activity activity, int messageId, int yes, int no, OnClickListener yesListener, OnClickListener noListener) {
    if (activity != null) {
        String title = context.getString(2131100003);
        String msg = context.getString(messageId);
        String y = context.getString(yes);
        Dialog dialog = new Builder(activity).setTitle(title).setMessage(msg).setPositiveButton(y, yesListener).setNegativeButton(context.getString(no), noListener).create();
        if (!activity.isFinishing() && !activity.isRestricted()) {
            try {
                dialog.show();
            } catch (Exception e) {
            }
        }
    }
}
项目:TripBuyer    文件:MMAlert.java   
public static AlertDialog showAlert(final Context context, final String title, final String msg, final View view, 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.setTitle(title);
    builder.setMessage(msg);
    builder.setView(view);
    builder.setPositiveButton(R.string.app_ok, lOk);
    builder.setNegativeButton(R.string.app_cancel, lCancel);
    // builder.setCancelable(true);
    builder.setOnCancelListener(new DialogInterface.OnCancelListener() {

        @Override
        public void onCancel(DialogInterface dialog) {
            if (lCancel != null) {
                lCancel.onClick(dialog, 0);
            }
        }
    });
    final AlertDialog alert = builder.create();
    alert.show();
    return alert;
}
项目:letv    文件:UIs.java   
public static void call(Activity activity, int messageId, OnClickListener yes) {
    if (activity != null) {
        Dialog dialog = new Builder(activity).setTitle(2131100003).setIcon(2130837921).setMessage(messageId).setPositiveButton(2131100002, yes).create();
        if (!activity.isFinishing() && !activity.isRestricted()) {
            try {
                dialog.show();
            } catch (Exception e) {
            }
        }
    }
}
项目:letv    文件:UIs.java   
public static void callDialogMsgPositiveButton(Activity activity, String msgId, OnClickListener yes) {
    TipBean dialogMsgByMsg = TipUtils.getTipBean(msgId);
    if (activity != null && dialogMsgByMsg != null) {
        CharSequence string;
        Builder builder = new Builder(activity);
        if ("".equals(dialogMsgByMsg.title) || dialogMsgByMsg.title == null) {
            string = activity.getString(2131100003);
        } else {
            string = dialogMsgByMsg.title;
        }
        Dialog dialog = builder.setTitle(string).setIcon(2130837921).setMessage(dialogMsgByMsg.message).setPositiveButton(2131100002, yes).create();
        if (!activity.isFinishing() && !activity.isRestricted()) {
            try {
                dialog.show();
            } catch (Exception e) {
            }
        }
    }
}
项目:letv    文件:UIs.java   
public static void callDialogMsgPosNeg(Activity activity, String msgId, int yes, int no, OnClickListener yesListener, OnClickListener noListener) {
    TipBean dialogMsgByMsg = TipUtils.getTipBean(msgId);
    if (activity != null && dialogMsgByMsg != null) {
        CharSequence string;
        Builder builder = new Builder(activity);
        if ("".equals(dialogMsgByMsg.title) || dialogMsgByMsg.title == null) {
            string = activity.getString(2131100003);
        } else {
            string = dialogMsgByMsg.title;
        }
        Dialog dialog = builder.setTitle(string).setIcon(2130837921).setMessage(dialogMsgByMsg.message).setCancelable(false).setPositiveButton(yes, yesListener).setNegativeButton(no, noListener).create();
        if (!activity.isFinishing() && !activity.isRestricted()) {
            try {
                dialog.show();
            } catch (Exception e) {
            }
        }
    }
}
项目:letv    文件:UIsUtils.java   
public static void callDialogMsgPosNeg(Activity activity, String msgId, int yes, int no, OnClickListener yesListener, OnClickListener noListener) {
    TipBean dialogMsgByMsg = TipUtils.getTipBean(msgId);
    if (activity != null && dialogMsgByMsg != null) {
        CharSequence string;
        Builder builder = new Builder(activity);
        if ("".equals(dialogMsgByMsg.title) || dialogMsgByMsg.title == null) {
            string = activity.getString(R.string.dialog_default_title);
        } else {
            string = dialogMsgByMsg.title;
        }
        Dialog dialog = builder.setTitle(string).setIcon(R.drawable.dialog_icon).setMessage(dialogMsgByMsg.message).setCancelable(false).setPositiveButton(yes, yesListener).setNegativeButton(no, noListener).create();
        if (!activity.isFinishing() && !activity.isRestricted()) {
            try {
                dialog.show();
            } catch (Exception e) {
            }
        }
    }
}
项目:letv    文件:DialogUtil.java   
public static void call(Context activity, String title, String message, int yes, int no, OnClickListener yesListener, OnClickListener noListener, boolean cancelable) {
    if (activity != null) {
        Dialog dialog = new Builder(activity).setTitle(title).setIcon(R.drawable.dialog_icon).setMessage(message).setCancelable(cancelable).setPositiveButton(yes, yesListener).setNegativeButton(no, noListener).create();
        if ((activity instanceof Activity) && !((Activity) activity).isFinishing() && !activity.isRestricted()) {
            dialog.show();
        }
    }
}
项目:TripBuyer    文件:MMAlert.java   
public static AlertDialog showAlert(final Context context, final String title, final View view, final String ok, final String cancel, 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.setTitle(title);
    builder.setView(view);
    builder.setPositiveButton(ok, lOk);
    builder.setNegativeButton(cancel, lCancel);
    // builder.setCancelable(false);
    final AlertDialog alert = builder.create();
    alert.show();
    return alert;
}
项目:TripBuyer    文件:MMAlert.java   
public static AlertDialog showAlert(final Context context, final String msg, final String title, final String yes, final String no, 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(title);
    builder.setMessage(msg);
    builder.setPositiveButton(yes, lOk);
    builder.setNegativeButton(no, lCancel);
    // builder.setCancelable(false);
    final AlertDialog alert = builder.create();
    alert.show();
    return alert;
}
项目:buildAPKsApps    文件:CommonPrefs.java   
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;
}
项目:TripBuyer    文件:MMAlert.java   
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;
}
项目:DroidPlugin    文件:InstalledFragment.java   
private void doUninstall(final ApkItem item) {
    AlertDialog.Builder builder = new Builder(getActivity());
    builder.setTitle("警告,你确定要删除么?");
    builder.setMessage("警告,你确定要删除" + item.title + "么?");
    builder.setNegativeButton("删除", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (!PluginManager.getInstance().isConnected()) {
                Toast.makeText(getActivity(), "服务未连接", Toast.LENGTH_SHORT).show();
            } else {
                try {
                    PluginManager.getInstance().deletePackage(item.packageInfo.packageName, 0);
                    Toast.makeText(getActivity(), "删除完成", Toast.LENGTH_SHORT).show();
                } catch (RemoteException e) {
                    e.printStackTrace();
                }
            }
        }
    });
    builder.setNeutralButton("取消", null);
    builder.show();
}
项目:boohee_v5.6    文件:TimeLineUtility.java   
public static void showDeleteDialog(final Activity activity, final Post post, final
PostMenuListener postMenuListener) {
    new Builder(activity).setMessage("确定要删除吗?").setPositiveButton("删除", new DialogInterface
            .OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            StatusApi.deletePost(activity, post.id, new JsonCallback(activity) {
                public void ok(JSONObject object) {
                    super.ok(object);
                    if (postMenuListener != null) {
                        postMenuListener.onPostDelete();
                    }
                }
            });
        }
    }).setNegativeButton("取消", null).show();
}
项目:boohee_v5.6    文件:CustomSportListAdapter.java   
public void onClick(View v) {
    new Builder(CustomSportListAdapter.this.context).setMessage("确定要删除吗?")
            .setPositiveButton("删除", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            if (CustomSportListAdapter.this.data != null) {
                FoodApi.deleteCustomActivities(((CustomSport) CustomSportListAdapter.this
                        .data.get(DelListener.this.position)).id, CustomSportListAdapter
                        .this.context, new JsonCallback((Activity) CustomSportListAdapter
                        .this.context) {
                    public void onFinish() {
                        super.onFinish();
                    }

                    public void ok(JSONObject object) {
                        super.ok(object);
                        CustomSportListAdapter.this.remove(DelListener.this.position);
                        CustomSportListAdapter.this.notifyDataSetChanged();
                    }
                });
            }
        }
    }).setNegativeButton("取消", null).show();
}
项目:boohee_v5.6    文件:CustomFoodListAdapter.java   
public void onClick(View v) {
    new Builder(CustomFoodListAdapter.this.context).setMessage("确定要删除吗?")
            .setPositiveButton("删除", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            if (CustomFoodListAdapter.this.data != null) {
                FoodApi.deleteCustomFood(((CustomFood) CustomFoodListAdapter.this.data
                        .get(DelListener.this.position)).id, CustomFoodListAdapter.this
                        .context, new JsonCallback((Activity) CustomFoodListAdapter.this
                        .context) {
                    public void onFinish() {
                        super.onFinish();
                    }

                    public void ok(JSONObject object) {
                        super.ok(object);
                        CustomFoodListAdapter.this.remove(DelListener.this.position);
                        CustomFoodListAdapter.this.notifyDataSetChanged();
                    }
                });
            }
        }
    }).setNegativeButton("取消", null).show();
}
项目:boohee_v5.6    文件:ViewUtils.java   
public static void showTimeDialog(Context context, Alarm alarm, AlarmDao alarmDao, TextView
        text_view) {
    final TimePickerWheelView timePickerView = new TimePickerWheelView(context, alarm.hour,
            alarm.minute);
    final Alarm alarm2 = alarm;
    final TextView textView = text_view;
    final AlarmDao alarmDao2 = alarmDao;
    final Context context2 = context;
    new Builder(context).setView(timePickerView).setPositiveButton(R.string.y8, new
            OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            alarm2.hour = timePickerView.getHour();
            alarm2.minute = timePickerView.getMinute();
            textView.setText(alarm2.formatTime());
            alarmDao2.update(alarm2);
            if (alarm2.is_open()) {
                RemindService.start(alarm2, context2);
            }
        }
    }).show();
}
项目:boohee_v5.6    文件:FragmentApn.java   
private void showSelectCategory() {
    int size = this.mCategories.size();
    if (size != 0) {
        CharSequence[] items = new CharSequence[size];
        for (int i = 0; i < size; i++) {
            items[i] = ((CategoryModel) this.mCategories.get(i)).content;
        }
        new Builder(getActivity()).setTitle(R.string.c1).setItems(items, new DialogInterface
                .OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                CategoryModel category = (CategoryModel) FragmentApn.this.mCategories.get
                        (which);
                FragmentApn.this.viewSelectCategory.setTag(category.key);
                FragmentApn.this.viewSelectCategory.setText(category.content);
                FragmentApn.this.viewSelectCategory.setTextColor(-16777216);
            }
        }).create().show();
    }
}
项目:boohee_v5.6    文件:ShareActivity.java   
private void j() {
    if (this.a.getDrawable() != null) {
        String str = "";
        if (this.D != null) {
            switch (aa.a[this.D.getMediaType().ordinal()]) {
                case 1:
                    str = "音乐";
                    break;
                case 2:
                    str = "图片";
                    break;
                case 3:
                    str = "视频";
                    break;
            }
        }
        new Builder(this).setMessage("你确定删除" + str + "吗?").setCancelable(false)
                .setPositiveButton("确定", new x(this)).setNegativeButton("取消", new w(this))
                .create().show();
    }
}
项目:boohee_v5.6    文件:UMQQSsoHandler.java   
private void showDialog() {
    Builder builder = new Builder(this.mContext);
    TextView title = new TextView(this.mContext);
    title.setText("分享失败原因");
    title.setPadding(0, 20, 0, 20);
    title.setTextColor(-1);
    title.setGravity(17);
    title.setTextSize(16.0f);
    builder.setCustomTitle(title);
    TextView textView = new TextView(this.mContext);
    textView.setText("请添加QQ平台到SDK \n添加方式:\nUMQQSsoHandler qqSsoHandler = new UMQQSsoHandler" +
            "(getActivity(), \"你的APP ID\",\"你的APP KEY\");\nqqSsoHandler.addToSocialSDK(); " +
            "\n参考文档:\nhttp://dev.umeng" +
            ".com/social/android/share/quick-integration#social_qq_sso");
    textView.setTextColor(-1);
    textView.setTextSize(16.0f);
    textView.setAutoLinkMask(1);
    builder.setView(textView);
    builder.show().show();
}
项目:boohee_v5.6    文件:d.java   
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;
}
项目:boohee_v5.6    文件:d.java   
private static Builder a(Context context, String str, OnClickListener onClickListener, String str2, OnClickListener onClickListener2) {
    Builder builder = new Builder(context);
    if (a) {
        if (!(TextUtils.isEmpty(str2) || onClickListener2 == null)) {
            builder.setPositiveButton(str2, onClickListener2);
        }
        if (!(TextUtils.isEmpty(str) || onClickListener == null)) {
            builder.setNegativeButton(str, onClickListener);
        }
    } else {
        if (!(TextUtils.isEmpty(str) || onClickListener == null)) {
            builder.setPositiveButton(str, onClickListener);
        }
        if (!(TextUtils.isEmpty(str2) || onClickListener2 == null)) {
            builder.setNegativeButton(str2, onClickListener2);
        }
    }
    return builder;
}
项目:COB    文件:Notification.java   
@SuppressLint("NewApi")
private void changeTextDirection(Builder dlg){
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    dlg.create();
    AlertDialog dialog =  dlg.show();
    if (currentapiVersion >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
        TextView messageview = (TextView)dialog.findViewById(android.R.id.message);
        messageview.setTextDirection(android.view.View.TEXT_DIRECTION_LOCALE);
    }
}
项目:COB    文件:Notification.java   
@SuppressLint("NewApi")
private AlertDialog.Builder createDialog(CordovaInterface cordova) {
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        return new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    } else {
        return new AlertDialog.Builder(cordova.getActivity());
    }
}
项目:COB    文件:Notification.java   
@SuppressLint("NewApi")
private void changeTextDirection(Builder dlg){
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    dlg.create();
    AlertDialog dialog =  dlg.show();
    if (currentapiVersion >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
        TextView messageview = (TextView)dialog.findViewById(android.R.id.message);
        messageview.setTextDirection(android.view.View.TEXT_DIRECTION_LOCALE);
    }
}
项目:q-mail    文件:CheckBoxListPreference.java   
@Override
protected void onPrepareDialogBuilder(final Builder builder) {
    mPendingItems = new boolean[mItems.length];

    System.arraycopy(mCheckedItems, 0, mPendingItems, 0, mCheckedItems.length);

    builder.setMultiChoiceItems(mItems, mPendingItems,
    new DialogInterface.OnMultiChoiceClickListener() {
        @Override
        public void onClick(final DialogInterface dialog, final int which,
        final boolean isChecked) {
            mPendingItems[which] = isChecked;
        }
    });
}
项目:TripBuyer    文件:MMAlert.java   
public static AlertDialog showAlert(final Context context, final int msg, final int title, final int yes, final int no, 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(title);
    builder.setMessage(msg);
    builder.setPositiveButton(yes, lOk);
    builder.setNegativeButton(no, lCancel);
    // builder.setCancelable(false);
    final AlertDialog alert = builder.create();
    alert.show();
    return alert;
}
项目:ceji_android    文件:PromptManager.java   
/**
 * 显示错误提示框
 * 
 * @param context
 * @param msg
 */
public static void showErrorDialog(Context context, String msg) {
    new Builder(context)//
            .setIcon(R.mipmap.ic_launcher)//
            .setTitle(R.string.app_name)//
            .setMessage(msg)//
            .setNegativeButton("OK", null)//
            .show();
}
项目:stynico    文件:jni_string.java   
@TargetApi(21)
   public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked)
   {
       if (isChecked && compoundButton == mCompoundButton
    && getResources().getBoolean(R.bool.use_accessibility_service)
    && WatchingAccessibilityService.getInstance() == null)
{
           new Builder(this).setMessage(R.string.dialog_enable_accessibility_msg)
    .setPositiveButton(R.string.dialog_enable_accessibility_positive_btn, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which)
        {
        Intent intent = new Intent();
        intent.setAction("android.settings.ACCESSIBILITY_SETTINGS");
        startActivity(intent);

        }
    }).setNegativeButton(R.string.dialog_enable_accessibility_Nagetive_btn, this).setOnCancelListener(this).create().show();
           DefaultSharedPreferences.save(this, isChecked);
       }
else if (compoundButton == mCompoundButton)
{
           DefaultSharedPreferences.save(this, isChecked);
           if (isChecked)
    {
               ViewWindow.showView(this, getPackageName() + "\n" + getClass().getName());
           }
    else
    {
               ViewWindow.removeView();
           }
       }
   }
项目:dcs-sdk-java    文件:CommonUtil.java   
/**
 * 展示一个通用的弹出框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();
}
项目:aos-FileCoreLibrary    文件:WiFiDirectReceiverActivity.java   
private void noNetworkDialog(){
    Builder dialogNoNetwork;

    dialogNoNetwork = new AlertDialog.Builder(this);
    dialogNoNetwork.setCancelable(true);
    dialogNoNetwork.setOnCancelListener(new DialogInterface.OnCancelListener() {
        public void onCancel(DialogInterface dialog) {
            finish();
        }
    });
    dialogNoNetwork.setTitle(R.string.nonetwork_title);
    dialogNoNetwork.setMessage(getString(R.string.nonetwork_message));
    dialogNoNetwork.show();
}
项目:aos-FileCoreLibrary    文件:WiFiDirectSenderActivity.java   
private void noNetworkDialog(){
    Builder dialogNoNetwork;

    dialogNoNetwork = new AlertDialog.Builder(this);
    dialogNoNetwork.setCancelable(true);
    dialogNoNetwork.setOnCancelListener(new DialogInterface.OnCancelListener() {
        public void onCancel(DialogInterface dialog) {
            finish();
        }
    });
    dialogNoNetwork.setTitle(R.string.nonetwork_title);
    dialogNoNetwork.setMessage(getString(R.string.nonetwork_message));
    dialogNoNetwork.show();
}
项目:airgram    文件:UpdateActivity.java   
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());
}