Clicking an URL into a TextView

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Clicking an URL into a TextView

Postby erbedo » Wed Jun 04, 2008 9:43 am

Hi
I have a textview where i display an EULA URL. The user must be able to click this link to display the EULA if he/she wants. How can I do that? I simply put the URL into the TextView but after that it is not clickable..

Thank you
Proudly supporting Android :)
erbedo
Junior Developer
Junior Developer
 
Posts: 22
Joined: Thu Mar 13, 2008 9:39 pm

Top

Postby plusminus » Sat Jun 07, 2008 10:29 am

Hello eurobo,

use the following piece of code to linkify emails, phonenumbers or URLs in a TextView:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. android.text.util.Linkify.addLinks(myTextView, mask);
  2.  
  3. // mask can be 'ALL' or 'EMAIL_ADDRESSES' or 'PHONE_NUMBERS' or 'WEB_URLS'
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


More info can be found here:
http://code.google.com/android/referenc ... nkify.html

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests