android:autoLink - Have a Clickable Phone Number link in a TextView, in XML

How to Have Clickable Phone Number link in a TextView, in XML

android:autoLink was added in API Level 1

1. Create an Android project, if you don't already have one.

2. Add a TextView.

3. In the main.xml file, add the below lines.

<TextView
      ....
      android:text="219-555-1234"
      android:autoLink = "phone"
/>

 
4. Compile and run!

5. Click on the TextView and the link should open your default telephone dialer app. 

Related Articles


Resources: