As part of my newest app (Hacker News for Android), I needed to add the ability to click on links in a ListView, and have them open in the browser, while maintaining the ability for the user to click on the ListView row itself, and have the row listen to the click.
If you try using Linkify and LinkMovementMethod, which you’d use on normal links in a TextView, you’ll find that you can no longer use the ListView properly.
The solution I’m using is slightly modified from this answer on StackOverflow here.
Just drop this in as a replacement for your normal TextView, and you’ll have the clicks on links in your text intercepted. Hope this helps a fellow developer!
Like this post? Any other Android tips you’d like to hear about? Let me know on Twitter or Google Plus, or leave a comment.