javiersantos / MaterialStyledDialogs

A library that shows a beautiful and customizable Material-based dialog with header. API 14+ required.
Apache License 2.0
1.17k stars 155 forks source link

Could not find a method submit(View) #20

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hi,

I tried adding the library and repository to my build.gradle without problem. I didn't implement the dialog box code yet.. The problem is, when I click my login button, it shows this error :

Could not find a method submit(View) 
...
 Caused by: java.lang.NoSuchMethodException: submit [class android.view.View]

The error gone when I remove the library and repository.

Can anyone help me why is this happened?

Thank you.

javiersantos commented 8 years ago

Have a look to the layout where you added the login button, you will see something like this:

<Button
...
android:onClick="submit"
...
/>

Your activity must include the next method:

public void submit(View view) {
    // Your code when tapped the login button
}

BTW, this is something related to your layout. If you remove the onClick line the exception won't be thrown.

ghost commented 8 years ago

@javiersantos Yes of course I already include that. No problem before adding the library. After adding it, this error occur. That's why i am posting it here because of this library I wanted to use on my app.

javiersantos commented 8 years ago

It could happen for several reasons. Take a look at this stackoverflow question (may be related to your problem).

If you want you could paste the full log and activity/layout files.