我已经实现了一个 Android 应用程序,并且刚刚添加了MonkeyTalk库,通过记录用户与应用程序的交互来测试系统的可用性。
使用这个库后,一切正常,但是 DatePicker!
我使用以下方法显示 DatePicker 对话框:
private void setSpecificDate() {
int mYear = calendar.get(Calendar.YEAR);
int mMonth = calendar.get(Calendar.MONTH);
int mDay = calendar.get(Calendar.DAY_OF_MONTH);
DatePickerDialog dpd = new DatePickerDialog(getActivity(),
new OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear,
int dayOfMonth) {
// part of code uses retrieved data from DataPicker...
}
}, mYear, mMonth, mDay);
dpd.show();
}
然后,只要我点击显示 DatePicker,它就会崩溃,我得到运行时错误,程序失败!
当我只是注释掉dpd.show();
它时它可以工作,但没有任何反应。
我还测试了使用 TimePicker 而不是 DatePicker 来检查应用程序的行为,并且成功了!
运行时错误:
E/AndroidRuntime( 2679): FATAL EXCEPTION: main
E/AndroidRuntime( 2679): Process: com.parse.f8, PID: 2679
E/AndroidRuntime( 2679): java.lang.reflect.UndeclaredThrowableException
E/AndroidRuntime( 2679): at $Proxy6.onItemSelected(Unknown Source)
E/AndroidRuntime( 2679): at android.widget.AdapterView.fireOnSelected(AdapterView.java:897)
E/AndroidRuntime( 2679): at android.widget.AdapterView.access$200(AdapterView.java:48)
E/AndroidRuntime( 2679): at android.widget.AdapterView$SelectionNotifier.run(AdapterView.java:865)
E/AndroidRuntime( 2679): at android.os.Handler.handleCallback(Handler.java:739)
E/AndroidRuntime( 2679): at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime( 2679): at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime( 2679): at android.app.ActivityThread.main(ActivityThread.java:5221)
E/AndroidRuntime( 2679): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 2679): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 2679): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
E/AndroidRuntime( 2679): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
E/AndroidRuntime( 2679): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime( 2679): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 2679): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 2679): at com.gorillalogic.fonemonkey.automators.AutomatorBase$MonkeyInvocationHandler.invoke(AutomatorBase.java:571)
E/AndroidRuntime( 2679): at java.lang.reflect.Proxy.invoke(Proxy.java:397)
E/AndroidRuntime( 2679): ... 12 more
E/AndroidRuntime( 2679): Caused by: java.lang.IllegalStateException: Unable to find field mOnDateChangedListener in any superclass of android.view.View$ListenerInfo
E/AndroidRuntime( 2679): at com.gorillalogic.fonemonkey.automators.AutomatorBase.chainListenerFor(AutomatorBase.java:483)
E/AndroidRuntime( 2679): at com.gorillalogic.fonemonkey.automators.DatePickerAutomator.installDefaultListeners(DatePickerAutomator.java:43)
E/AndroidRuntime( 2679): at com.gorillalogic.fonemonkey.FunctionalityAdder.processView(FunctionalityAdder.java:71)
E/AndroidRuntime( 2679): at com.gorillalogic.fonemonkey.FunctionalityAdder.walkTree(FunctionalityAdder.java:48)
E/AndroidRuntime( 2679): at com.gorillalogic.fonemonkey.FunctionalityAdder.walkTree(FunctionalityAdder.java:58)
E/AndroidRuntime( 2679): at com.gorillalogic.fonemonkey.FunctionalityAdder.walkTree(FunctionalityAdder.java:58)
E/AndroidRuntime( 2679): at com.gorillalogic.fonemonkey.FunctionalityAdder.walkTree(FunctionalityAdder.java:58)
E/AndroidRuntime( 2679): at com.gorillalogic.fonemonkey.FunctionalityAdder.walkTree(FunctionalityAdder.java:58)
E/AndroidRuntime( 2679): at com.gorillalogic.fonemonkey.FunctionalityAdder.walkTree(FunctionalityAdder.java:58)
E/AndroidRuntime( 2679): at com.gorillalogic.fonemonkey.FunctionalityAdder.walkTree(FunctionalityAdder.java:58)
E/AndroidRuntime( 2679): at com.gorillalogic.fonemonkey.aspects.OnCreate.ajc$afterReturning$com_gorillalogic_fonemonkey_aspects_OnCreate$7$35d40fb6(OnCreate.aj:115)
E/AndroidRuntime( 2679): at com.parse.f8.view.SettingAdvTime.setSpecificDate(SettingAdvTime.java:396)
E/AndroidRuntime( 2679): at com.parse.f8.view.SettingAdvTime.access$3(SettingAdvTime.java:373)
E/AndroidRuntime( 2679): at com.parse.f8.view.SettingAdvTime$1.onItemSelected(SettingAdvTime.java:122)
E/AndroidRuntime( 2679): ... 16 more
我将不胜感激任何人的协助来解决这个问题。