How to get EditText value and display it on screen through TextView?


Question

I want to get the user input for the EditText view and display it on the screen through TextView when the Button is clicked. I also, want to know what modifications can be done on the string.xml file to do this.

1
46
6/4/2017 4:51:00 AM

Accepted Answer

I didn't get the second question, maybe you can elaborate...but for your first query.

String content = edtEditText.getText().toString(); //gets you the contents of edit text
tvTextView.setText(content); //displays it in a textview..
91
12/9/2010 8:57:16 AM

I'm just beginner to help you for getting edittext value to textview. Try out this code -

EditText edit = (EditText)findViewById(R.id.editext1);
TextView tview = (TextView)findViewById(R.id.textview1);
String result = edit.getText().toString();
tview.setText(result);

This will get the text which is in EditText Hope this helps you.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon