Hello!

On the javadoc for the android:onclick xml attribute, it says the following.
What does the part about being able to provide a "reference to a resource"
mean? Do I have the ability to configure any class in my project to be a
handler for onclick events or does it have to be a context (activity)?
Daring to follow the javadoc as it looked did not help. I had this line:
android:onClick="@com.gv.android:Handler:makeMeCoffee" for a method named
com.gv.andoid.Handler#makeMeCoffee. However, the compiler complained
with layout\student_listing.xml:11:
error: Error: No resource type specified (at 'onClick' with value
'@com.gv.android:Handler:makeMeCoffee').. Yes, I do have the Handler class
with a makeMeCoffee method.

android:onClick
Since: API 
Level<http://developer.android.com/guide/appendix/api-levels.html#level>

Name of the method in this View's context to invoke when the view is
clicked. This name must correspond to a public method that takes exactly one
parameter of type View. For instance, if you specify
android:onClick="sayHello", you must declare a public void
sayHello(View v) method
of your context (typically, your Activity).

Must be a string value, using '\\;' to escape characters such as '\\n' or
'\\uxxxx' for a unicode character.

This may also be a reference to a resource (in the form "@[*package*:]*type*
:*name*") or theme attribute (in the form "?[*package*:][*type*:]*name*")
containing a value of this type.

This corresponds to the global attribute resource symbol
onClick<http://developer.android.com/reference/android/R.attr.html#onClick>
.
 Related Methods

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to