Introduction
This article helps to describe how to call separate person in phone dialer for an Android Application, using Android Studio.
Requirements
Android Studio version 2.1.3
If you develop phone dialer Application, you should follow the steps given below.
Step 1
Open Android Studio, choose the File and select the New. Afterwards, click New Project. Here, you will write the Application name, select the Next, select the Target version, choose the Activity and write the activity name. Afterwards, click Finish.
Step 2
Here, you will go to activity_main.xml and build the design, which is like options button Textview .
Graphical User Interface design.
![]()
Step 3
Now, you will build XML code in Activity_main.xml code.
- <?xml version="1.0" encoding="utf-8"?>
- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingBottom="@dimen/activity_vertical_margin"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- tools:context="xyz.rvconstructions.www.phonedialerapp.MainActivity">
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:layout_marginBottom="25dip"
- android:text="@string/main_label"
- android:textColor="@color/colorPrimary"
- android:textSize="22sp"
- android:id="@+id/textView" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="New Button"
- android:id="@+id/button"
- android:layout_below="@+id/textView"
- android:layout_centerHorizontal="true" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="New Button"
- android:id="@+id/button2"
- android:layout_below="@+id/button"
- android:layout_alignLeft="@+id/button"
- android:layout_alignStart="@+id/button" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="New Button"
- android:id="@+id/button3"
- android:layout_below="@+id/button2"
- android:layout_centerHorizontal="true" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="New Button"
- android:id="@+id/button4"
- android:layout_below="@+id/button3"
- android:layout_alignLeft="@+id/button3"
- android:layout_alignStart="@+id/button3" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="New Button"
- android:id="@+id/button5"
- android:layout_below="@+id/button4"
- android:layout_alignLeft="@+id/button4"
- android:layout_alignStart="@+id/button4" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="New Button"
- android:id="@+id/button6"
- android:layout_below="@+id/button5"
- android:layout_alignLeft="@+id/button5"
- android:layout_alignStart="@+id/button5" />
- </RelativeLayout>
- //xml string
- <resources>
- <string name="app_name">PhoneDialerApp</string>
- <string name="main_label">My Friends</string>
- </resources>
Step 4
Now, you will go to MainActivity.java code and build Java code. First of all, you would declare the header file.
Step 5
Here, you will declare the local variable.
![]()
Step 6
Here, you will declare the set up buttons and attach click listeners.
Step 6
Here, you will declare the
launchDialer() method.
Step 7
Now, you need to declare the
populateArrays() method.
Step 8
Here, you will declare onClick() method.
Step 9
Now, you will see the full MainActivity.java code.
Step 10
Now, run the Application. After few minutes, you would be able to see the given output.
![]()
Here, you will select the one person. Afterwards, you would call to that person.
![]()
Here, you will choose any one action.
![]()
Now, you would call to that person.
Summary
I hope, this article helped you on how to call separate person via a phone dialer in an Android Application, using Android Studio.