How to change Textview if input change ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to change Textview if input change ?

hello, in android studio i have an input type in android + button i need, If the first word begins with a letter H Textview change to ( Letter H ) and if the first word begins with a letter V Textview change to ( Letter V ) Thank you ❤

11th Sep 2017, 7:52 AM
Mohammed Elhafed Messini
Mohammed Elhafed Messini - avatar
1 Answer
+ 4
Same as here: https://www.sololearn.com/Discuss/699513/how-to-change-text-on-button-click but add: EditText editText = (EditText)findViewById(R.id.my_edittext); and in the onclick add: String text = editText.getText().toString(); textView.setText("Letter " + text.charAt(0)); //charAt(0) gets the first character of the string as a char.
11th Sep 2017, 9:44 AM
ChaoticDawg
ChaoticDawg - avatar