Search code examples
androidandroid-edittextidentifier

How to retrieve EditText's xml id


I have a form with many EditTexts, and when I press a certain button, I need to retrieve all these controls and put them into a HashMap so the key is the name (key1 int the following code)

<EditText android:id="@+id/key1" 
        style="@style/keys" /> 

and the value, whatever text the user enters.

My question is, how can I retrieve the name of the EditText for the Hashmap's keys ? getId() returns a number.

Thanks


Solution

  • I finally solved it using android:tag and getTag()