androidlistviewhyperlinkautolink

autoLink with onClick event


I have a list of web address display in a ListView. Each item of ListView have a TextView and an ImageView. TextView have attribute autolink="web".

I also have event: onItemLongClick in this ListView to open details of each others. But when I do long click event on each item in list, they do open new page also open browser with link website in TextView.

How can I set when onItemLongClick, the TextView can't click into link? I try set TextView.setLinkClickable(false) but it isn't working.

Many thanks


Solution

  • You can achieve what you want in this way.

    1. on your .xml, add this to the TextView :

      TextView ... android:autoLink="web" android:textIsSelectable="true"

    2. on your code use ListView click behavior and longClick behavior.