java.lang.IllegalStateException:在活动类中找不到onConvertButtonClick(View)方法

时间:2015-03-25 13:28:56

标签: android

{main} java.lang.IllegalStateException: Could not find a method onConvertButtonClick(View) in the activity class android.view.ContextThemeWrapper for onClick handler on view class android.widget.LinearLayout with id 'action_convert' at android.view.View$1.onClick(View.java:3594) at android.view.View.performClick(View.java:4212) at android.view.View$PerformClick.run(View.java:17476) at android.os.Handler.handleCallback(Handler.java:800) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:194) at android.app.ActivityThread.main(ActivityThread.java:5371) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NoSuchMethodException: onConvertButtonClick [class android.view.View] at java.lang.Class.getConstructorOrMethod(Class.java:460) at java.lang.Class.getMethod(Class.java:915) at android.view.View$1.onClick(View.java:3587) ... 11 more

1 个答案:

答案 0 :(得分:0)

好像你在Layout.xml中为onClick声明了一个方法,但在你的Activity中,这个视图没有这样的方法:

java.lang.NoSuchMethodException: [..]

尝试:

private void onConvertButtonClick(View v){
Log.(LOGTAG, "onClick");
}