Android: Multiple Click Actions on Single Text View
My Task was to show ‘User Name’ , ‘status’ and ‘Song Name’ in a single line.
The ‘User Name’ and ‘Song Name’ have different clickable functions.
The basic or simple approach to solve the problem is by creating a 3 TextView under a Linear Layout and implementing different onClickListener on every TextView.
This approach is quite lengthy, poor in performance and difficult to maintain for a developer for future scopes.
So, the better way for dealing this problem is by using 1 TextView with SpannableString.
You can add more actions by modifying the method.
❤ Please hit clap if you learned something!
If you have any questions leave a comment below or message me on Linkedin.