I have a TextView
in my ArrayAdapter
that may contain some hyperlinks. For those links I use Linkify
:
public View get
In your Activity.Java while binding your list with adapter
YourAdapter yourAdapter = new YourAdapter(YourCurrentActivityName.this, YourArrayList);
yourListView.setAdapter(yourAdapter);
In YourAdapter.java in Constructor make sure it's Activity not Context
public YourAdapter(Activity context, YourArrayList list){
this.context = context;
this.list = list;
}
And, use this code for your textview in your adapter for Linkify.
holder.yourTextView.setLinksClickable(true);
holder.yourTextView.setMovementMethod(LinkMovementMethod.getInstance());
Linkify.addLinks(holder.yourTextView, Linkify.ALL);
holder.yourTextView.setAutoLinkMask(Linkify.ALL);