3

In an activity I can set android:onClick in the XML file to the name of a method in my in my Activity object. I want to read a table in my sqlite database, create buttons, and set the onClick to point to a method in my Activity just like I can if I add static views in my XML file.

Can I do this instead of having to create View.OnClickListener() objects. I find the XML approach much easier to read in my Java code. If this is not possible, how does the XML do it?

  • have you had a look at this question? http://stackoverflow.com/questions/4153517/how-exactly-does-the-androidonclick-xml-attribute-differ-from-setonclicklistene – Jade Byfield Dec 10 '12 at 23:15

0 Answers0