Java.lang.NoSuchMethodException: [Class Android.view.View]

Source: Internet
Author: User

05-24 11:38:35.884:e/androidruntime (1819): FATAL exception:main
05-24 11:38:35.884:e/androidruntime (1819): Process:com.example.activitytest, pid:1819
05-24 11:38:35.884:e/androidruntime (1819): Java.lang.IllegalStateException:Could not find a method (View) in the Act Ivity class com.example.activitytest.ThirdActivity for OnClick handler on view class Android.widget.Button
05-24 11:38:35.884:e/androidruntime (1819): at Android.view.view$1.onclick (view.java:3810)
05-24 11:38:35.884:e/androidruntime (1819): at Android.view.View.performClick (view.java:4438)
05-24 11:38:35.884:e/androidruntime (1819): at Android.view.view$performclick.run (view.java:18422)
05-24 11:38:35.884:e/androidruntime (1819): at Android.os.Handler.handleCallback (handler.java:733)
05-24 11:38:35.884:e/androidruntime (1819): at Android.os.Handler.dispatchMessage (handler.java:95)
05-24 11:38:35.884:e/androidruntime (1819): at Android.os.Looper.loop (looper.java:136)
05-24 11:38:35.884:e/androidruntime (1819): at Android.app.ActivityThread.main (activitythread.java:5017)
05-24 11:38:35.884:e/androidruntime (1819): At Java.lang.reflect.Method.invokeNative (Native Method)
05-24 11:38:35.884:e/androidruntime (1819): at Java.lang.reflect.Method.invoke (method.java:515)
05-24 11:38:35.884:e/androidruntime (1819): At Com.android.internal.os.zygoteinit$methodandargscaller.run ( zygoteinit.java:779)
05-24 11:38:35.884:e/androidruntime (1819): at Com.android.internal.os.ZygoteInit.main (zygoteinit.java:595)
05-24 11:38:35.884:e/androidruntime (1819): At Dalvik.system.NativeStart.main (Native Method)
05-24 11:38:35.884:e/androidruntime (1819): Caused by:java.lang.NoSuchMethodException: [Class Android.view.View]
05-24 11:38:35.884:e/androidruntime (1819): at Java.lang.Class.getConstructorOrMethod (class.java:472)
05-24 11:38:35.884:e/androidruntime (1819): at Java.lang.Class.getMethod (class.java:857)
05-24 11:38:35.884:e/androidruntime (1819): at Android.view.view$1.onclick (view.java:3803)
05-24 11:38:35.884:e/androidruntime (1819): ... One More

Android:onclick= "" In the layout file of the button does not add a method

This is because you add it to a view control in the current xxxxactivity without a method, such as my error is a button to add an OnClick method, so click this imageview times error, It is possible that you did not instantiate this imageview in the current activity, but in this ImageView acitivity interface, you can see if you add a iamgeview to this android:o in this imageview layout. Nclick= "true" property

Java.lang.NoSuchMethodException: [Class Android.view.View]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.