Win a copy of The Business Blockchain this week in the Cloud 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: 42969
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic