In a project there are setTag()
and getTag()
in ExpandableListView
. I am not able to understand the exact use of the methods. I have gone through many blogs on the internet which made me confused. Can anyone help me to come out of this with a neat and clear explanation?
Asked
Active
Viewed 59 times
-1

Phantômaxx
- 37,901
- 21
- 84
- 115
-
Please [edit] your question to better explain what you did not "get" from the relevant posts here; e.g., https://stackoverflow.com/questions/5291726/what-is-the-main-purpose-of-settag-gettag-methods-of-view, https://stackoverflow.com/questions/25531253/androidpurpose-of-gettag-and-settag-in-view-class, etc. There's one specific to the `ViewHolder` pattern in an `AdapterView`, if that's what your example project is using it for: https://stackoverflow.com/questions/25966689/what-is-the-working-of-settag-and-gettag-in-viewholder-pattern. – Mike M. Sep 03 '19 at 11:43
1 Answers
0
in order to be able to get exact view element from your list view you should set tag in your adapter while creating specific view.
for instance, you want to find specific view element for click action and then you want to use TextView's text attribute you can access via v.getTag().toString();
please check this out to understand better

Zafer Celaloglu
- 1,438
- 1
- 17
- 28