I'm having one EditText
in android
in which I want the user to enter the text I'll store the db. But, here I am not able to get the value from EditText
.
Here is my code,
EditText etUserInfoNewValue = (EditText)findViewById(R.id.etUserInfoNewVal);
String newValue = etUserInfoNewValue.getText().toString().trim();
How can I get the value from this EditText
?
Put
String newValue = etUserInfoNewValue.getText().toString().trim();
Inside the button's onClicklistener()
.
You have put this code in onCreate() just after declaring it, it won't have any value at all. So you will get null value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With