Atmaram Atmaram -4 years ago 97
Android Question

How to Set an array as Tag to any View through layout xml in android

I want to bind some extra data with a view. I am using tag in my xml file to add the extra information.

If the data is only String (

android:tag="extra Info"
), i am able to get the extra data by using
getTag()
in code.

But i want to bind multiple data as object to a view, for that i am setting an array as tag.
When i tried to set
android:tag="@array/xyz_array"
, I am still getting a String object instead of an array from
getTag()
.

Can any body tell me, if i am doing something wrong ??

Answer Source

You can't do this from XML, XML supports only strings for view tags.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download