shaqed
shaqed

Reputation: 392

java.lang.IllegalStateException: Could not find a method after Parse implementation

I've read everywhere - couldn't find a solution.

My project was working fine, I stated the methods I wanted to be called to the onClick inside the XML file like this:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:theme="@style/AppTheme"
android:id="@+id/actualMainActivity"
tools:context=".ActualMainActivity"
><Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Add new noob"
    android:id="@+id/addNewNoob"
    android:layout_marginLeft="33dp"
    android:layout_marginStart="33dp"
    android:onClick="addNewNoob"
    android:layout_alignTop="@+id/listOfNoobs"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true" /></RelativeLayout>

the method inside my java class (ActualMainActivity) was like this:

  public void addNewNoob(View view) {
    Log.i("Tag", "you clicked the add button");
}    

Only after I've implemented the Parse SDK to work with, my Gradle resynced and now when I run the application I get the 'Method not found exception'. I would like to point out that when I assign an onClickListener directly to the button like this: final Button a = (Button) findViewById(R.id.addNewNoob); a.setOnClickListener(new View.OnClickListener(){ public void onClick(View v) { Log.i("Tag", "you clicked the add button"); } });

that works perfectly fine...

What have I changed when I installed the SDK ? How can I get back to the way that I write the methods on XML and they are executed accordingly.

Really confused... thanks in advance

here's the logcat:

02-09 11:29:34.917    2669-2669/com.example.shaked.sqliteexample02 E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.shaked.sqliteexample02, PID: 2669
java.lang.IllegalStateException: Could not find a method listOfNoobs(View) in the activity class android.view.ContextThemeWrapper for onClick handler on view class android.widget.Button with id 'listOfNoobs'
        at android.view.View$1.onClick(View.java:3994)
        at android.view.View.performClick(View.java:4756)
        at android.view.View$PerformClick.run(View.java:19749)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:135)
        at android.app.ActivityThread.main(ActivityThread.java:5221)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
 Caused by: java.lang.NoSuchMethodException: listOfNoobs [class android.view.View]
        at java.lang.Class.getMethod(Class.java:664)
        at java.lang.Class.getMethod(Class.java:643)
        at android.view.View$1.onClick(View.java:3987)

         
Thanks in advance

Upvotes: 1

Views: 982

Answers (2)

Abhishek Jain
Abhishek Jain

Reputation: 315

its giving methodexception error so see to it that the method named listofnoobs() is not missing. also clean your project and then rebuild it

Upvotes: 0

Muthu
Muthu

Reputation: 1022

Create a New Project move the old Classes to the New one and Check!

Upvotes: 3

Related Questions