Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

How to make a phone call from your Android App?

  • Difficulty Level : Medium
  • Last Updated : 17 Jan, 2020

In this article, you will make a basic android application which can be used to call some number through your android application.

You can do so with the help of Intent with action as ACTION_CALL. Basically Intent is a simple message object that is used to communicate between android components such as activities, content providers, broadcast receivers and services, here use to make phone call. This application basically contain one activity with edit text to write phone number on which you want to make a call and button to call that number.

  • Step 1. Permission code in Android-Manifest.xml file
    You need to take permission from user for phone call and for that CALL_PHONE permission is added in manifest file.Here is code of manifest file:


    <?xml version="1.0" encoding="utf-8"?>  
    <manifest xmlns:androclass=""  
        android:versionName="1.0" >  
            android:targetSdkVersion="16" />  
        <!--permission for phone call-->
        <uses-permission android:name="android.permission.CALL_PHONE" />  
            android:theme="@style/AppTheme" >  
                android:label="@string/gfg" >  
                    <action android:name="android.intent.action.MAIN" />  
                    <category android:name="android.intent.category.LAUNCHER" />  
  • Step 2. activity_main.xml
    activity_main.xml contains a Relative Layout which contains Edit text to write phone number on which you want to make phone call and button for starting intent or making call :


    <?xml version="1.0" encoding="utf-8"?>
    <!--Relative Layout-->
       <!--Edit text for phone number-->
       <!--Button to make call-->
            android:text="Make Call!!" 

  • Step 3.
    In Main activity Intent object is created to redirect activity to call manager and action attribute of intent is set as ACTION_CALL.Phone number input by user is parsed through Uri and that is passed as data in Intent object which is than use to call that phone number.setOnClickListener is attached to button with intent object in it to make intent with action as ACTION_CALL to make phone call.Here is complete code:

    package com.geeksforgeeks.phonecall;
    import android.os.Bundle;
    import android.content.Intent;
    import android.widget.EditText;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.Button;
    public class MainActivity extends AppCompatActivity {
        // define objects for edit text and button
        EditText edittext;
        Button button;
        protected void onCreate(Bundle savedInstanceState)
            // Getting instance of edittext and button
            button = findViewById(;
            edittext = findViewById(;
            // Attach set on click listener to the button
            // for initiating intent
            button.setOnClickListener(new OnClickListener() {
                public void onClick(View arg)
                    // getting phone number from edit text
                    // and changing it to String
                    String phone_number
                        = edittext.getText().toString();
                    // Getting instance of Intent
                    // with action as ACTION_CALL
                    Intent phone_intent
                        = new Intent(Intent.ACTION_CALL);
                    // Set data of Intent through Uri
                    // by parsing phone number
                                           + phone_number));
                    // start Intent


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!