Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display phone call window when click on phone number text

Tags:

android

Im displaying contact details on a screen. I need to display phone call window to appear when user clicks on phone number in the contact details.

Please let me know How i can do this

Thanks in advance

like image 667
praveenb Avatar asked Oct 19 '10 17:10

praveenb


People also ask

What is click to call How is it created?

At it's most basic form, click-to-call technology works by the end user enters her phone number and requests a call. An intermediary service then dials the end user and other third party and initiates a conversation between the two parties.

How do I make a phone call using Javascript?

You can simply add an onclick handler to your <tr> tag, then call window. open("tel:+1800229933"); .


2 Answers

I find answer

<TextView  android:text="888-468-0602"  
    android:autoLink="phone" />
like image 128
praveenb Avatar answered Oct 06 '22 01:10

praveenb


use this code

String number = "9423012345";

txt.setTag(number);

txt.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {   

Intent callIntent = new Intent(Intent.ACTION_CALL);

callIntent.setData(Uri.parse("tel:"+(String) v.getTag()));

callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 

startActivity(callIntent);

}});    

And add this line to your manifest file

uses-permission android:name="android.permission.CALL_PHONE"
like image 27
Imran Avatar answered Oct 06 '22 00:10

Imran