Mahir Duraković
Mahir Duraković

Reputation: 135

Numbers in string to be callable

I am working on my Android app, and I saved some text that containts data, phone numbers and e-mail adresses in my strings.xml file and I display that text in my TextView. Is it possible to make when someone click on phone number to call that number ? I wanna make same with e-mail adresses...

Upvotes: 5

Views: 2451

Answers (1)

Eric B.
Eric B.

Reputation: 4702

Use this line in you textView Xml for phone

    android:autoLink="phone" 
    android:linksClickable="true"

and this for email:

   android:autoLink="email" 
   android:linksClickable="true"

EDIT

If you want to check for email, phone number and url use these lines:

    android:autoLink="web|email|phone"
    android:linksClickable="true"

Upvotes: 10

Related Questions