How to make Link inside Android TextView Click able


Getting links working from html is kind of tricky:

  1. Apply your text via xml android:text="@string/… or via setText() (see other answers)
  2. Use textView.setMovementMethod(LinkMovementMethod.getInstance()) to make links clickable (see other answers)
  3. Do NOT add android:autoLink="web" to you XML resource (section TextView), otherwise A-tags are not rendered correctly and are not clickable any longer.

Remark 1:
The OnClickListener can be helpful, if your TextView contains only one link and you want to trigger the navigation even if the user clicks aside your link, but inside the TextView.

Remark 2:
android:linksClickable="true" still does not work (as of Android 3.2), use p. 2 instead

http://stackoverflow.com/questions/4790746/links-in-textview

2 thoughts on “How to make Link inside Android TextView Click able

  1. I believe this is among the most important information
    for me. And i am glad reading your article. But want to statement on few common things, The web site
    style is great, the articles is in reality great : D. Just right task, cheers

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s