Search code examples
androidbackspace

Backspace to delete whole word (entity) instead of each letter/character


In my app, I have an edittext which will contain a user (brought from db). There is the possibility that more than a user be present inside the edittext in the following manner : UserX, UserY, UserZ

I want to make the backspace of the virtual keyboard function in such a way that upon click, it deletes the whole user, rather than each character.

Any hints how to do this? As I did not find anything upon my searches. (perhaps I was using wrong keywords)


Solution

  • I suggest you use a SpannableString.Here is a complete guide : link. Good luck !