12

I have TextView and it contain HTML with tags. I need to intercept user's clicks on this links, take value of "href" parameter, check it and open my activity if it local link or open browser if it link to another site.

I've try to search and find that, but I can't understand how to use it in my case.

Please, help.

BArtWell
  • 4,176
  • 10
  • 63
  • 106
  • I can't answer your question for doing this in a TextView. It seems like a WebView would suit your purpose. – Jason Hessley Oct 21 '12 at 20:45
  • And if you finally use the WebView, remember, JavaScript is disabled by default. – moskis Oct 21 '12 at 21:10
  • Possible duplicate of [handle textview link click in my android app](http://stackoverflow.com/questions/1697084/handle-textview-link-click-in-my-android-app) – Sufian Nov 24 '16 at 15:04

1 Answers1

5

There's this method: https://stackoverflow.com/a/3452944/1799219

All it's really doing is passing the link to your own activity (as links are normally passed to other activities) and then you extract the URL.

Community
  • 1
  • 1
Casey Gibson
  • 2,577
  • 1
  • 20
  • 23