Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Binding EditText text to a variable?

I am trying to bind the text of EditText object to a local for the view variable, but probably I do not understand how.

  • How could bind EditText object with a variable in Java - Android 4.0.3 ?
like image 734
Milosh Silk Avatar asked Dec 03 '25 02:12

Milosh Silk


2 Answers

Make an variableChangedListener like so

In the listener, add setText(variable) for the EditText

like image 132
Gjordis Avatar answered Dec 04 '25 17:12

Gjordis


You can bind EditText to the local variable of type EditText

EditText text=new EditText(this);

text=youredittex;
like image 35
Pragnani Avatar answered Dec 04 '25 17:12

Pragnani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!