Skip to content Skip to sidebar Skip to footer

The Onclick() Of Clickablespan Is Not Working For Urlspan?

In a TextView, I want to popup a toast whenever a hyperlink is clicked, instead of opening the corresponding url in a browser. I use the following code, but the problem here is the

Solution 1:

Actually my senior figured out, we need to remove the original URLSpan before adding our own spans using setSpan()

// The original URLSpan needs to be removed to block the behavior of browser opening
    strBuilder.removeSpan(span);

Thanks Damian.

Post a Comment for "The Onclick() Of Clickablespan Is Not Working For Urlspan?"