views:

59

answers:

1

Is there a way to have a Linkify'd link call a method in my Activity or am I only allowed to use Linkify to create links to other activities / apps etc.?

A: 

Nope. Linkify comes with:

  • EMAIL_ADDRESSES
  • MAP_ADDRESSES
  • PHONE_NUMBERS
  • WEB_URLS

You can try extending it. Here's the src code.

Macarse
that's not totally true, you can create links to custom urls and match on things other than what you mentioned using Linkify.addLinks(holder.messageText, myRegexPattern, "content://com.my.app/people/?url=",null, new MyLinkTransform(msg.getUrl()));
Ben
@Ben: You are right. What I try to say is that it brings that by default. I will modify my answer.
Macarse
I wish they had an api similar to the webview (webview.setJavascriptInterface()) where i could essentially tack-on my own custom java code when they click on the link...
Ben