android对话框中的非法参数异常

android对话框中的非法参数异常,第1张

概述我正在使用此代码显示警告对话框…当我点击确定按钮时,它应显示日期选择器.. protected Dialog onCreateDialog(int id) { switch (id) { case TIME_DIALOG_ID: return new TimePickerDialog(ListReminderActivity.this, 我正在使用此代码显示警告对话框…当我点击确定按钮时,它应显示日期选择器..
protected Dialog onCreateDialog(int ID) {    switch (ID) {    case TIME_DIALOG_ID:        return new TimePickerDialog(ListReminderActivity.this,mTimeSetListener,mHour,mMinute,false);    case DATE_DIALOG_ID:        return new DatePickerDialog(ListReminderActivity.this,mDateSetListener,mYear,mMonth,mDay);    case DESCRIPTION_DIALOG_ID:        return new AlertDialog.Builder(ListReminderActivity.this).setTitle(                "Add Reminder").setVIEw(description).setPositivebutton(                R.string.add_alert_ok,new DialogInterface.OnClickListener() {                    public voID onClick(DialogInterface dialog,int whichbutton) {                        ListReminderActivity.this                                .dismissDialog(DESCRIPTION_DIALOG_ID);                        ListReminderActivity.this                                .removeDialog(DESCRIPTION_DIALOG_ID);                        ListReminderActivity.this                                .showDialog(DATE_DIALOG_ID);                    }                }).setNegativebutton(R.string.add_alert_cancel,int whichbutton) {                        ListReminderActivity.this                                .dismissDialog(DESCRIPTION_DIALOG_ID);                        ListReminderActivity.this                                .removeDialog(DESCRIPTION_DIALOG_ID);                    }                }).create();    }    return null;}

但问题是..当我按下确定按钮时,我得到了例外

例外是……

09-09 10:30:48.941: ERROR/AndroIDRuntime(1189): FATAL EXCEPTION: main09-09 10:30:48.941: ERROR/AndroIDRuntime(1189): java.lang.IllegalArgumentException: current should be >= start and <= end09-09 10:30:48.941: ERROR/AndroIDRuntime(1189):     at androID.Widget.NumberPicker.setCurrent(NumberPicker.java:288)09-09 10:30:48.941: ERROR/AndroIDRuntime(1189):     at androID.Widget.DatePicker.updateDaySpinner(DatePicker.java:364)09-09 10:30:48.941: ERROR/AndroIDRuntime(1189):     at androID.Widget.DatePicker.updateSpinners(DatePicker.java:350)09-09 10:30:48.941: ERROR/AndroIDRuntime(1189):     at androID.Widget.DatePicker.init(DatePicker.java:346)09-09 10:30:48.941: ERROR/AndroIDRuntime(1189):     at androID.app.DatePickerDialog.<init>(DatePickerDialog.java:124)09-09 10:30:48.941: ERROR/AndroIDRuntime(1189):     at androID.app.DatePickerDialog.<init>(DatePickerDialog.java:83)09-09 10:30:48.941: ERROR/AndroIDRuntime(1189):     at com.app.reminder.ListReminderActivity.onCreateDialog(ListReminderActivity.java:149)09-09 10:30:48.941: ERROR/AndroIDRuntime(1189):     at androID.app.Activity.onCreateDialog(Activity.java:2472)09-09 10:30:48.941: ERROR/AndroIDRuntime(1189):     at androID.app.Activity.createDialog(Activity.java:881)09-09 10:30:48.941: ERROR/AndroIDRuntime(1189):     at androID.app.Activity.showDialog(Activity.java:2547)09-09 10:30:48.941: ERROR/AndroIDRuntime(1189):     at androID.app.Activity.showDialog(Activity.java:2514)09-09 10:30:48.941: ERROR/AndroIDRuntime(1189):     at com.app.reminder.ListReminderActivity.onClick(ListReminderActivity.java:164)09-09 10:30:48.941: ERROR/AndroIDRuntime(1189):     at com.androID.internal.app.AlertController$buttonHandler.handleMessage(AlertController.java:158)09-09 10:30:48.941: ERROR/AndroIDRuntime(1189):     at androID.os.Handler.dispatchMessage(Handler.java:99)09-09 10:30:48.941: ERROR/AndroIDRuntime(1189):     at androID.os.Looper.loop(Looper.java:123)09-09 10:30:48.941: ERROR/AndroIDRuntime(1189):     at androID.app.ActivityThread.main(ActivityThread.java:4627)09-09 10:30:48.941: ERROR/AndroIDRuntime(1189):     at java.lang.reflect.Method.invokeNative(Native Method)09-09 10:30:48.941: ERROR/AndroIDRuntime(1189):     at java.lang.reflect.Method.invoke(Method.java:521)09-09 10:30:48.941: ERROR/AndroIDRuntime(1189):     at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)09-09 10:30:48.941: ERROR/AndroIDRuntime(1189):     at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:626)09-09 10:30:48.941: ERROR/AndroIDRuntime(1189):     at dalvik.system.NativeStart.main(Native Method)
解决方法 如您在日志中看到的错误所示,您的mYear,mMonth或mDay值之一无效. 总结

以上是内存溢出为你收集整理的android对话框中的非法参数异常全部内容,希望文章能够帮你解决android对话框中的非法参数异常所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/web/1138934.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)

保存