问题
I'm trying to use a date picker to select a date in my application, but I've been stopped by the following error. Can anyone help me in clearing this issue?
The date picker dialog should pop-up on touching an EditText.
Here's my Code:
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();
}
};
Here's my Log for your reference:
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:
Atlast I decided to remove Monkey Talk from my project and the now the date picker is working fine.
来源:https://stackoverflow.com/questions/31075930/my-date-picker-is-not-working