我的日期选择器不起作用

时间:2015-06-26 14:36:52

标签: android eclipse datepicker monkeytalk

我正在尝试使用日期选择器在我的应用程序中选择日期,但我已被以下错误拦截了。任何人都可以帮我解决这个问题吗?

触摸EditText时会弹出日期选择器对话框。

这是我的代码:

myCalendar = Calendar.getInstance();

    fromDate_textView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            new DatePickerDialog(Sell_Product_Activity.this, date,
                    myCalendar.get(Calendar.YEAR), myCalendar
                            .get(Calendar.MONTH), myCalendar
                            .get(Calendar.DAY_OF_MONTH)).show();
        }
    });

    date = new DatePickerDialog.OnDateSetListener() {

        @Override
        public void onDateSet(DatePicker view, int year, int monthOfYear,
                int dayOfMonth) {
            // TODO Auto-generated method stub
            myCalendar.set(Calendar.YEAR, year);
            myCalendar.set(Calendar.MONTH, monthOfYear);
            myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);
            updateLabel();
        }

    };

这是我的日志供您参考:

06-26 19:59:47.858: E/AndroidRuntime(26770): FATAL EXCEPTION: main
06-26 19:59:47.858: E/AndroidRuntime(26770): Process: com.bvibes, PID: 26770
06-26 19:59:47.858: E/AndroidRuntime(26770): java.lang.IllegalStateException: Unable to find field mOnDateChangedListener in any superclass of android.view.View$ListenerInfo
06-26 19:59:47.858: E/AndroidRuntime(26770):    at com.gorillalogic.fonemonkey.automators.AutomatorBase.chainListenerFor(AutomatorBase.java:483)
06-26 19:59:47.858: E/AndroidRuntime(26770):    at com.gorillalogic.fonemonkey.automators.DatePickerAutomator.installDefaultListeners(DatePickerAutomator.java:43)
06-26 19:59:47.858: E/AndroidRuntime(26770):    at com.gorillalogic.fonemonkey.FunctionalityAdder.processView(FunctionalityAdder.java:71)
06-26 19:59:47.858: E/AndroidRuntime(26770):    at com.gorillalogic.fonemonkey.FunctionalityAdder.walkTree(FunctionalityAdder.java:48)
06-26 19:59:47.858: E/AndroidRuntime(26770):    at com.gorillalogic.fonemonkey.FunctionalityAdder.walkTree(FunctionalityAdder.java:58)
06-26 19:59:47.858: E/AndroidRuntime(26770):    at com.gorillalogic.fonemonkey.FunctionalityAdder.walkTree(FunctionalityAdder.java:58)
06-26 19:59:47.858: E/AndroidRuntime(26770):    at com.gorillalogic.fonemonkey.FunctionalityAdder.walkTree(FunctionalityAdder.java:58)
06-26 19:59:47.858: E/AndroidRuntime(26770):    at com.gorillalogic.fonemonkey.FunctionalityAdder.walkTree(FunctionalityAdder.java:58)
06-26 19:59:47.858: E/AndroidRuntime(26770):    at com.gorillalogic.fonemonkey.FunctionalityAdder.walkTree(FunctionalityAdder.java:58)
06-26 19:59:47.858: E/AndroidRuntime(26770):    at com.gorillalogic.fonemonkey.FunctionalityAdder.walkTree(FunctionalityAdder.java:58)
06-26 19:59:47.858: E/AndroidRuntime(26770):    at com.gorillalogic.fonemonkey.aspects.OnCreate.ajc$afterReturning$com_gorillalogic_fonemonkey_aspects_OnCreate$7$35d40fb6(OnCreate.aj:115)
06-26 19:59:47.858: E/AndroidRuntime(26770):    at com.bvibes.Sell_Product_Activity$1.onClick(Sell_Product_Activity.java:138)
06-26 19:59:47.858: E/AndroidRuntime(26770):    at android.view.View.performClick(View.java:4761)
06-26 19:59:47.858: E/AndroidRuntime(26770):    at android.view.View$PerformClick.run(View.java:19767)
06-26 19:59:47.858: E/AndroidRuntime(26770):    at android.os.Handler.handleCallback(Handler.java:739)
06-26 19:59:47.858: E/AndroidRuntime(26770):    at android.os.Handler.dispatchMessage(Handler.java:95)
06-26 19:59:47.858: E/AndroidRuntime(26770):    at android.os.Looper.loop(Looper.java:135)
06-26 19:59:47.858: E/AndroidRuntime(26770):    at android.app.ActivityThread.main(ActivityThread.java:5312)
06-26 19:59:47.858: E/AndroidRuntime(26770):    at java.lang.reflect.Method.invoke(Native Method)
06-26 19:59:47.858: E/AndroidRuntime(26770):    at java.lang.reflect.Method.invoke(Method.java:372)
06-26 19:59:47.858: E/AndroidRuntime(26770):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
06-26 19:59:47.858: E/AndroidRuntime(26770):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)

1 个答案:

答案 0 :(得分:0)

Atlast我决定从我的项目中删除Monkey Talk,现在日期选择器工作正常。