Browse - Programming Tips - How do I get the text from an EditText widget?

Date: 2015jul30
OS: Android
Language: Java

Q.  How do I get the text from an EditText widget?

A.	You need to do toString() on the return of getText() like this:

EditText editText = (EditText) findViewById(R.id.my_edittext); String s = editText.getText().toString().trim();
Doesn't hurt to throw in a trim() too.