How to Set a Tag for a TextView
added in API Level 1* Use android:id instead when you can. *
Supply a tag for this view containing a String, to be retrieved later with View.getTag() or searched for with View.findViewWithTag(). It is generally preferable to use IDs (through the android:id attribute) instead of tags because they are faster and allow for compile-time typing checking.
1. Add a TextView in your main.xml file.
2. In the main.xml file, add the code below.
<TextView
...
android:tag = "myTag"
/>
3. Compile and run!
Related Articles:
Resources: