AlertDialog.Builder

时间:2016-02-01 06:53:34

标签: android android-alertdialog android-4.2-jelly-bean

我想显示AlertDialog.Builder用于检查互联网在Android 5及更高版本中的工作正常但在版本之下显示异常,如此

02-01 12:11:49.805 3220-3220/com.iglulabs.medine1 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.iglulabs.medine1, PID: 3220
java.lang.NoClassDefFoundError: com.iglulabs.medine1.utils.Utility$6
    at com.iglulabs.medine1.utils.Utility.showExistingEmailUserLoginDialog(Utility.java:1116)
    at com.iglulabs.medine1.activity.LoginActivity.onClick(LoginActivity.java:661)
    at android.view.View.performClick(View.java:4446)
    at android.view.View$PerformClick.run(View.java:18437)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5447)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:970)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:786)
    at dalvik.system.NativeStart.main(Native Method)

我尝试了很多,但我无法找到解决方案,请帮我解决这个问题。

我的代码是

AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(LoginActivity.this, R.style.MyAlertDialogStyle);
    dialogBuilder.setTitle(title);
    dialogBuilder.setMessage(message);
    dialogBuilder.setCancelable(false);
    dialogBuilder.setPositiveButton("Proceed", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            ((AlertResult.RedeemPointResult) processResult).alertResult(true);
        }
    });

    dialogBuilder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            ((AlertResult.RedeemPointResult) processResult).alertResult(false);
        }
    });

    dialogBuilder.show();

1 个答案:

答案 0 :(得分:1)

使用Multidex参考此链接 Multidex