How to set a text based on the EditText id and not on the EditText name?

1

When I set a text in an EditText I do so.

EditText edit = new EditText(this);
edit.setId(0+4);
edit.setText("Meu Texto");

But I presumed to set the text by the id because in my case I have several editText called "edit". They have the same name but different ids. It is possible? Thank you in advance.

    
asked by anonymous 05.08.2015 / 16:08

1 answer

3
If the EditText is associated with a View / Layout you can get the reference to each of them through Id using:

>
EditText edit = (EditText)view.findViewById(id);  

view is the LinearLayout where the EditText     

05.08.2015 / 16:24