I am using eclipse and brand new to android. I want to know How to print the string entered by the user in EditText column. I am taking the input from the user but i want to use the string entered by the user in my program. How should i do that??
4 Answers 4
http://android-er.blogspot.com/2009/07/exercise-hello-world-with-edittext.html
EditText edit_text = (EditText) findViewById(R.id.message_text);
CharSequence edit_text_value = edit_text.getText();
3 Comments
toString() will make your lives easier. (Not really mandated) String class also has the method charAt(). But there are also a lot of cool functions on the String class that might help you achieve what you want to do without manipulating chars. docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html It has to have .toString()
String strEditText = editText.getText().toString(); // For getting text from EditText System.out.println ( strEditText ); // For Printing
2 Comments
please try this
String strEditText = editText.getText().toString();
System.out.println ( strEditText );
now use this strEditText for using edittext value
4 Comments
Its Very Simple,
String strEditText = editText.getText().toString(); // For getting text from EditText
System.out.println ( strEditText ); // For Printing
You can also visit here for example of how to retriver EditText's String.