In% with% declared in this way below, the TextView
is used as the definition of the 1
attribute. See:
<TextView
android:id="@+id/tvJonSnow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tag="1"
android:text="Jon Snow" />
Programmatically the android:tag
and setTag()
methods are used, as follows:
TextView tvJonSnow = (TextView) findViewByID(R.id.tvJonSnow);
tvJonSnow.setTag(1);
What is the purpose of methods getTag()
and setTag()
in getTag()
? When should they be used?