Android Step-by-Step
Your Step-by-Step Guide to Creating Android Apps
How to Get Text in an EditText and Save to a String
1.
Find an EditText using ID
, named
myEditText
.
2.
Declare a String Variable
named
StrEditText
.
3. In the onCreate method, add the below line. This will get the contents of the
myEditText
EditText and convert it to a string and save it to the String
strEditText
.
strEditText = myEditText.getText().toString();
4. Compile and run!
Newer Post
Older Post
Home
View mobile version
Popular Posts
Solution: error: Error parsing XML: unbound prefix
Change the line spacing between lines of text in an TextView/EditText, using lineSpacingExtra
How to Add a Toast
How to Create a ProGuard Exception
How to Set Permission for I/O Operations over NFC
android:requiresFadingEdge
android:id - How to Name a Rating Bar, in XML
android:maxWidth - Set the Maximum Width of TextView
How to Install an SDK package
findViewbyID - How to Find a RatingBar using ID