Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android make phone numbers clickable, autodetect

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?

like image 446
CQM Avatar asked Jun 27 '11 18:06

CQM


People also ask

How do you make a clickable number?

Href=tel: creates the call link. This tells the browser how to use the number. “Tel: 123-456-7890 “creates the HTML phone number. The number within the quotes is the number it will call.


1 Answers

Use

android:autoLink="phone" 

in textView in the xml layout file

like image 133
Amt87 Avatar answered Sep 18 '22 14:09

Amt87