Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieving view name property in android?

Tags:

android

Is there anyway to retrieve the name of a view in android? Have been walking through the api and haven't seen any method to do this.

like image 910
Notbad Avatar asked Mar 12 '12 10:03

Notbad


1 Answers

View only contains id not name, I think it's not able to retrieve it.

From your comment, I think you can put the index to the android:tag attribute

such as

<RadioButton android:tag="1" />

Then you can invoke button.getTag to fetch the tag value. Hope this helps you get rid of the switch case statements..

like image 115
Qiang Jin Avatar answered Oct 01 '22 11:10

Qiang Jin