Android make phone numbers clickable, autodetect

CQM picture CQM · Jun 27, 2011 · Viewed 24.5k times · Source

When I am using android on websites and reading emails, I notice that I can click on addresses to load into google maps, or click on phone numbers to call, or click on emails and send an email.

These elements on the web are formatted in a variety of ways, so there is some built in function that detects these sort of things.

How do I allow this within my app? I have a page which displays contact information in plain text and I would like the user to just be able to click.

Do I Absolutely need to create clicklisteners for each textview or is there a system function I just need to enable?

Answer

Amt87 picture Amt87 · Mar 20, 2013

Use

android:autoLink="phone"

in textView in the xml layout file