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 ??
You can't do this from XML, XML supports only strings for view tags.
Actually you can do that if you define tag elements as a child for views. Define multiple Tag attribute for View in xml layouts
<View ...>
<tag android:id="@+id/mytag"
android:value="@string/mytag_value" />
</View>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With