1

I was trying to understand the "Using Messenger" in Bound Service example in Android Documentation. The example had a method named sayHello(View v). I could not quite understand how the method is called and why it takes a view as a argument.

I hope the question can be useful to others and community will take the question positively.

Thanks.

Gaurav Agarwal
  • 18,754
  • 29
  • 105
  • 166

1 Answers1

1

You could define an 'android:onClick="method"' in layout.xml

This calls the method with parameter "View" of your activity

You may check this QA, too

How exactly does the android:onClick XML attribute differ from setOnClickListener?

Community
  • 1
  • 1
stefan bachert
  • 9,413
  • 4
  • 33
  • 40