Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to add a hyperlink textview in layout main.xml

 
Arslan Asif
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any one has any idea about adding a hyperlink in textview
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something like "Linkify.addLinks(yourView, Linkify.ALL)" turns everything Android knows what to do with into a hyperlink. There's also a variant of that method where you can provide a custom pattern to match.

Alternatively, add a ClickableSpan to the text you want to link - then you can provide an onClick handler that will get called upon clicking.
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are sample programs in API Demos package that demonstrate this.
 
Arslan Asif
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Monu Tripathi. Its resolved now.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!