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 ❤
1 Antwort
+ 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.