Save Number to Contact
Save Number to Contact:
Saving a number to contacts in an Android application refers to the process of adding a new contact or updating an existing contact with a specific phone number.
This can be achieved using the Android Contacts API.
Example:
<?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/saveNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/mobile"
android:layout_centerInParent="true"
android:text="Save Number"
android:textColor="#FFFFFF"
android:padding="16dp"
android:layout_marginTop="20dp"
android:background="@color/colorPrimaryDark"/>
</RelativeLayout>
</RelativeLayout>