Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android: How to call the number by android application [duplicate]

Tags:

android

Possible Duplicate:
how to make phone call using intent in android?

Please give me code for calling the number through android Application.

Thanks a lot

like image 279
Hardik Gajjar Avatar asked Apr 05 '11 12:04

Hardik Gajjar


People also ask

Why do contacts duplicate on Android?

Sometimes your phone creates two or more than two copies of a single contact. This mostly happens when you factory reset a device and sync contacts or change SIM and accidentally sync all contacts. This can completely clutter the contacts, making it hard to navigate through contacts.


2 Answers

Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:123456789"));
startActivity(callIntent);

Edit: Must add <uses-permission android:name="android.permission.CALL_PHONE" /> in Manifest as well.

like image 137
DKIT Avatar answered Oct 03 '22 02:10

DKIT


Try this,

Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:123456789"));
startActivity(callIntent);

And remember add this CALL_PHONE permission to your manifest.xml:

<uses-permission android:name="android.permission.CALL_PHONE" />

This may helps you.

like image 29
danhnn.uit Avatar answered Oct 03 '22 02:10

danhnn.uit