I would like to achieve an edit view that tags the text after a user has entered some text (in my case a phonenumber) and the user presses a comma. So for input that has Trevor Hansen, Alex Nelson, ...
the output will be like this:
Asked
Active
Viewed 70 times
0

musale
- 534
- 8
- 18
3 Answers
2

Shrenik Shah
- 1,900
- 1
- 11
- 19
-
nice answer +1, exactly is the same :) – Yasin Kaçmaz Jul 26 '16 at 11:13
-
@falcon if it helps kindly mark this as answer so that it can be helpful to others as well. – Shrenik Shah Jul 26 '16 at 11:16
-
@ShrenikShah thank you! Exactly what I was looking for. – musale Jul 26 '16 at 11:28
0
Go through the below code, add a TextWatcher and your logic:
phoneNumber = (EditText) findViewById(R.id.phone);
tag = (TextView) findViewById(R.id.tag);
phoneNumber.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
String mobNo = editable.toString();
if (mobNo != null && mobNo.length() >= 1) {
if (mobNo.contains(",")) {
mob = new SpannableString(mobNo.replace(",", ""));
tag.setText(mob);
phoneNumber.setText("");
}
}
}
});
Add your logic for multiple data persistence.

Kurt Van den Branden
- 11,995
- 10
- 76
- 85

Joyal C Joseph
- 290
- 2
- 12