-1

I am trying to create application which sends email without user interaction using this solution.

I am getting the following error

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ammad.emailmodule, PID: 2251
java.lang.IllegalStateException: Could not find method sendEmail(View) in a parent or ancestor Context for android:onClick attribute defined on view class android.support.v7.widget.AppCompatButton with id 'btnSend'
    at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.resolveMethod(AppCompatViewInflater.java:307)
    at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:266)
    at android.view.View.performClick(View.java:4438)
    at android.view.View$PerformClick.run(View.java:18422)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5017)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
    at dalvik.system.NativeStart.main(Native Method)

I am unable to solve this issue. Can anybody help me to find out what is the issue?

Community
  • 1
  • 1
ak131
  • 1
  • 1
  • 1
    It seems you have an `onClick` function for your send-button, could you please paste your Layout XML when you define the `btnSend`, for instance? – ishmaelMakitla May 01 '16 at 10:30

2 Answers2

0

In your xml in sendEmail button add attribute android:onClick="sendEmail".

Arthur
  • 769
  • 7
  • 17
0

Your not initialized the button so its shown this then add onclivk listener

Ramesh sambu
  • 3,577
  • 2
  • 24
  • 39