I don't need to call the phone number, I just need the dialer to open with the phone number already displayed. What Intent
should I use to achieve this?

- 12,245
- 6
- 43
- 74

- 7,114
- 8
- 51
- 75
7 Answers
Two ways to achieve it.
1) Need to start the dialer via code, without user interaction.
You need Action_Dial
,
use below code it will open Dialer with number specified
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:0123456789"));
startActivity(intent);
The 'tel:' prefix is required, otherwhise the following exception will be thrown: java.lang.IllegalStateException: Could not execute method of the activity.
Action_Dial doesn't require any permission.
If you want to initiate the call directly without user's interaction , You can use action Intent.ACTION_CALL
. In this case, you must add the following permission in your AndroidManifest.xml:
<uses-permission android:name="android.permission.CALL_PHONE" />
2) Need user to click on Phone_Number string and start the call.
android:autoLink="phone"
You need to use TextView with below property.
android:autoLink="phone" android:linksClickable="true" a textView property
You don't need to use intent or to get permission via this way.
-
10That is great and it differs than Intent.ACTION_CALL by that it doesn't call immediately – Amt87 Mar 10 '13 at 14:05
-
Does ACTION_DIAL requires the permission, or only ACCESS_CALL does? – Marc Plano-Lesay Oct 01 '13 at 13:06
-
rather than open a new queston, how would open the dialer and start the call (so you can have dialer options), just starting the call gives you no options for stop, speaker etc.. – Feb 02 '14 at 02:49
-
1This **works** with phone numbers from **Denmark** as well :) You **do not need** to add +45 before the number. It works fine just parsing the phone number – ymerdrengene Jun 04 '14 at 12:41
-
DOn't forget to add the following flag to your ACTION_DIAL intent. FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET. This will reset your task when you launch into your app again, and won't launch into the dialler by mistake. – Andrew Kelly Sep 03 '14 at 14:20
-
1Ive got problem with back button after opening dialer in new intent. I can get back to my application only in 3 back button press (it shows me several screens of dialer which I didnt open - the dialer itself, create new contact screen, favourites). Does somebody knows how to get back to app with only 1 back button press? – kashlo Oct 23 '16 at 01:26
-
@kashlo did you find solution for this? – André Vicente Oct 12 '17 at 00:34
-
@AndréVicente Ive asked a question about this problem, see the comment https://stackoverflow.com/questions/40220279/how-to-open-dialer-and-get-back-to-your-app-in-one-step-in-android – kashlo Oct 12 '17 at 09:00
-
32012... Good old days. It's politically correct 2018, big companies sell of user data and our apps need to deal with Android bureaucracy just to NOT support SMS and Phone calls. – Josh Dec 17 '18 at 14:41
Pretty late on the answer, but if you have a TextView
that you're showing the phone number in, then you don't need to deal with intents at all, you can just use the XML attribute android:autoLink="phone"
and the OS will automatically initiate an ACTION_DIAL
Intent.

- 6,629
- 3
- 30
- 35
Okay, it is going to be extremely late answer to this question. But here is just one sample if you want to do it in Kotlin.
val intent = Intent(Intent.ACTION_DIAL)
intent.data = Uri.parse("tel:<number>")
startActivity(intent)
Thought it might help someone.

- 14,813
- 5
- 66
- 90
You can call Intent following this:
String number = "0123456789";
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:" + number));
startActivity(intent);

- 184
- 1
- 6
As @ashishduh mentioned above, using android:autoLink="phone
is also a good solution. But this option comes with one drawback, it doesn't work with all phone number lengths. For instance, a phone number of 11 numbers won't work with this option. The solution is to prefix your phone numbers with the country code.
Example:
08034448845
won't work
but +2348034448845
will

- 26,627
- 26
- 120
- 132
<TextView
android:id="@+id/phoneNumber"
android:autoLink="phone"
android:linksClickable="true"
android:text="+91 22 2222 2222"
/>
This is how you can open EditText label assigned number on dialer directly.

- 567
- 6
- 14
A helper function for someone using kotlin:
fun openDialPad(context: Context, phoneNum: String) {
val intent = Intent(Intent.ACTION_DIAL)
intent.setData(Uri.parse("tel:$phoneNum"))
context.startActivity(intent)
}

- 2,016
- 20
- 30