79675841

Date: 2025-06-23 08:20:22
Score: 1
Natty:
Report link

Yes, you're absolutely on the right track. Using EditText with a TextWatcher to detect the @ symbol, showing a popup with user suggestions, and then inserting a styled span using setSpan() — this is the standard and correct way to implement @mention functionality in Android. Android doesn’t have a built-in component that does this out of the box, so a custom implementation like yours is common and totally valid.

That said, there are some helpful open-source libraries like SocialView that can make parts of this process easier, especially when it comes to detecting mentions and managing spans. But if you need fine control (like custom styling and storing user IDs), your current custom approach is usually the best way to go.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @mention
  • Low reputation (1):
Posted by: Dhruva