I have a question:
I have entered a text in EditText, ' My Name is Khan '
I just want to print just 'Khan' in TextView (not ' My Name is Khan ', just ' Khan ' I want in TextView).
How to do it?
Parse your string using split.
String[] s = edittext.getText.toString().split(Pattern.quote(" "));
Then get the last word.
String name = s[s.length-1];
Now set it
textView.setText(name);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.