September 13th, 2012, 01:24 PM
Clickable hyperlinks in a Listview/Gridview - Help!
I can't believe I cannot find this answer online, since it should be common to almost every app...please help me. I've been working on this single issue for two whole weeks!
Basically, I have a Listview or Gridview (tried both) that will display search results from a database query. This works great. Now I want to make each result a hyperlink, for example each row is in this format:
- <a href='mysite.com'>Result1</a>
I used Html.fromHtml() to change each row string into a Spanned type, and now each row (TextView) appears hyperlinked, but they won't click. I keep reading over and over that I need to simply add textView.setMovementMethod(LinkMovementMethod.getInstance());, HOWEVER, it crashes the program. I think this is because I'm not manually adding each TextView to the ListView, because I am using the ArrayAdapter to dynamically fill the ListView. Please let me know which direction I should go to get this working quickly, thanks!!!!!