Make a call
Make a call:
Making a call on an Android device involves using the ACTION_CALL intent to initiate a phone call.
Example:
// add following permission in AndroidManifest.xml
<uses-permission android:name="android.permission.CALL_PHONE"/>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:padding="16dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<EditText
android:id="@+id/mobile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter your mobile number"
android:inputType="phone"
android:textColor="#000000"
android:layout_marginTop="20dp"
android:layout_marginBottom="6dp"/>
<Button
android:id="@+id/call"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/mobile"
android:layout_centerInParent="true"
android:text="Click to Call"
android:textColor="#FFFFFF"
android:padding="16dp"
android:layout_marginTop="20dp"
android:background="@color/colorPrimaryDark"/>
</RelativeLayout>
</RelativeLayout>