Android - Phone Calls

<p >Android provides Built-in applications for phone calls, in some occasions we may need to make a phone call through our application. This could easily be done by using implicit Intent with appropriate actions. Also, we can use PhoneStateListener and TelephonyManager classes, in order to monitor the changes in some telephony states on the device.</p> <p >This chapter lists down all the simple steps to create an application which can be used to make a Phone Call. You can use Android Intent to make phone call by calling built-in Phone Call functionality of the Android. Following section explains different parts of our Intent object required to make a call.</p> <h2 >Intent Object - Action to make Phone Call</h2> <p >You will use<b >ACTION_CALL</b>action to trigger built-in phone call functionality available in Android device. Following is simple syntax to create an intent with ACTION_CALL action</p> <pre class="prettyprint notranslate prettyprinted" > <span class="typ" >Intent</span><span class="pln" > phoneIntent </span><span class="pun" >=</span><span class="pln" > </span><span class="kwd" >new</span><span class="pln" > </span><span class="typ" >Intent</span><span class="pun" >(</span><span class="typ" >Intent</span><span class="pun" >.</span><span class="pln" >ACTION_CALL</span><span class="pun" >);</span></pre> <p >You can use<b >ACTION_DIAL</b>action instead of ACTION_CALL, in that case you will have option to modify hardcoded phone number before making a call instead of making a direct call.</p> <h2 >Intent Object - Data/Type to make Phone Call</h2> <p >To make a phone call at a given number 91-000-000-0000, you need to specify<b >tel:</b>as URI using setData() method as follows &minus;</p> <pre class="prettyprint notranslate prettyprinted" > <span class="pln" >phoneIntent</span><span class="pun" >.</span><span class="pln" >setData</span><span class="pun" >(</span><span class="typ" >Uri</span><span class="pun" >.</span><span class="pln" >parse</span><span class="pun" >(</span><span class="str" >&quot;tel:91-000-000-0000&quot;</span><span class="pun" >));</span></pre> <p >The interesting point is that, to make a phone call, you do not need to specify any extra data or data type.</p> <h2 >Example</h2> <p >Following example shows you in practical how to use Android Intent to make phone call to the given mobile number.</p> <blockquote >To experiment with this example, you will need actual Mobile device equipped with latest Android OS, otherwise you will have to struggle with emulator which may not work.</blockquote> <table class="table table-bordered" > <tbody > <tr > <th class="fivepct" >Step</th> <th >Description</th> </tr> <tr > <td >1</td> <td >You will use Android studio IDE to create an Android application and name it as<i >My Application</i>under a package<i >com.example.saira_000.myapplication</i>. While creating this project, make sure you<i >Target SDK</i>and<i >Compile With</i>at the latest version of Android SDK to use higher levels of APIs.</td> </tr> <tr > <td >2</td> <td >Modify<i >src/MainActivity.java</i>file and add required code to take care of making a call.</td> </tr> <tr > <td >3</td> <td >Modify layout XML file<i >res/layout/activity_main.xml</i>add any GUI component if required. I&#39;m adding a simple button to Call 91-000-000-0000 number</td> </tr> <tr > <td >4</td> <td >No need to define default string constants.Android studio takes care of default constants.</td> </tr> <tr > <td >5</td> <td >Modify<i >AndroidManifest.xml</i>as shown below</td> </tr> <tr > <td >6</td> <td >Run the application to launch Android emulator and verify the result of the changes done in the application.</td> </tr> </tbody> </table> <p >Following is the content of the modified main activity file<b >src/MainActivity.java</b>.</p> <pre class="prettyprint notranslate prettyprinted" > <span class="kwd" >package</span><span class="pln" > com</span><span class="pun" >.</span><span class="pln" >example</span><span class="pun" >.</span><span class="pln" >saira_000</span><span class="pun" >.</span><span class="pln" >myapplication</span><span class="pun" >;</span><span class="pln" > </span><span class="kwd" >import</span><span class="pln" > android</span><span class="pun" >.</span><span class="pln" >app</span><span class="pun" >.</span><span class="typ" >Activity</span><span class="pun" >;</span><span class="pln" > </span><span class="kwd" >import</span><span class="pln" > android</span><span class="pun" >.</span><span class="pln" >content</span><span class="pun" >.</span><span class="typ" >Intent</span><span class="pun" >;</span><span class="pln" > </span><span class="kwd" >import</span><span class="pln" > android</span><span class="pun" >.</span><span class="pln" >net</span><span class="pun" >.</span><span class="typ" >Uri</span><span class="pun" >;</span><span class="pln" > </span><span class="kwd" >import</span><span class="pln" > android</span><span class="pun" >.</span><span class="pln" >support</span><span class="pun" >.</span><span class="pln" >v7</span><span class="pun" >.</span><span class="pln" >app</span><span class="pun" >.</span><span class="typ" >ActionBarActivity</span><span class="pun" >;</span><span class="pln" > </span><span class="kwd" >import</span><span class="pln" > android</span><span class="pun" >.</span><span class="pln" >os</span><span class="pun" >.</span><span class="typ" >Bundle</span><span class="pun" >;</span><span class="pln" > </span><span class="kwd" >import</span><span class="pln" > android</span><span class="pun" >.</span><span class="pln" >view</span><span class="pun" >.</span><span class="typ" >Menu</span><span class="pun" >;</span><span class="pln" > </span><span class="kwd" >import</span><span class="pln" > android</span><span class="pun" >.</span><span class="pln" >view</span><span class="pun" >.</span><span class="typ" >MenuItem</span><span class="pun" >;</span><span class="pln" > </span><span class="kwd" >import</span><span class="pln" > android</span><span class="pun" >.</span><span class="pln" >view</span><span class="pun" >.</span><span class="typ" >View</span><span class="pun" >;</span><span class="pln" > </span><span class="kwd" >import</span><span class="pln" > android</span><span class="pun" >.</span><span class="pln" >widget</span><span class="pun" >.</span><span class="typ" >Button</span><span class="pun" >;</span><span class="pln" > </span><span class="kwd" >import</span><span class="pln" > android</span><span class="pun" >.</span><span class="pln" >widget</span><span class="pun" >.</span><span class="typ" >RadioButton</span><span class="pun" >;</span><span class="pln" > </span><span class="kwd" >import</span><span class="pln" > android</span><span class="pun" >.</span><span class="pln" >widget</span><span class="pun" >.</span><span class="typ" >RadioGroup</span><span class="pun" >;</span><span class="pln" > </span><span class="kwd" >import</span><span class="pln" > android</span><span class="pun" >.</span><span class="pln" >widget</span><span class="pun" >.</span><span class="typ" >Toast</span><span class="pun" >;</span><span class="pln" > </span><span class="kwd" >public</span><span class="pln" > </span><span class="kwd" >class</span><span class="pln" > </span><span class="typ" >MainActivity</span><span class="pln" > </span><span class="kwd" >extends</span><span class="pln" > </span><span class="typ" >Activity</span><span class="pln" > </span><span class="pun" >{</span><span class="pln" > </span><span class="typ" >Button</span><span class="pln" > b1</span><span class="pun" >;</span><span class="pln" > </span><span class="lit" >@Override</span><span class="pln" > </span><span class="kwd" >protected</span><span class="pln" > </span><span class="kwd" >void</span><span class="pln" > onCreate</span><span class="pun" >(</span><span class="typ" >Bundle</span><span class="pln" > savedInstanceState</span><span class="pun" >)</span><span class="pln" > </span><span class="pun" >{</span><span class="pln" > </span><span class="kwd" >super</span><span class="pun" >.</span><span class="pln" >onCreate</span><span class="pun" >(</span><span class="pln" >savedInstanceState</span><span class="pun" >);</span><span class="pln" > setContentView</span><span class="pun" >(</span><span class="pln" >R</span><span class="pun" >.</span><span class="pln" >layout</span><span class="pun" >.</span><span class="pln" >activity_main</span><span class="pun" >);</span><span class="pln" > b1</span><span class="pun" >=(</span><span class="typ" >Button</span><span class="pun" >)</span><span class="pln" >findViewById</span><span class="pun" >(</span><span class="pln" >R</span><span class="pun" >.</span><span class="pln" >id</span><span class="pun" >.</span><span class="pln" >button</span><span class="pun" >);</span><span class="pln" > call</span><span class="pun" >();</span><span class="pln" > </span><span class="pun" >}</span><span class="pln" > </span><span class="kwd" >private</span><span class="pln" > </span><span class="kwd" >void</span><span class="pln" > call</span><span class="pun" >()</span><span class="pln" > </span><span class="pun" >{</span><span class="pln" > </span><span class="typ" >Intent</span><span class="pln" > </span><span class="kwd" >in</span><span class="pun" >=</span><span class="kwd" >new</span><span class="pln" > </span><span class="typ" >Intent</span><span class="pun" >(</span><span class="typ" >Intent</span><span class="pun" >.</span><span class="pln" >ACTION_CALL</span><span class="pun" >,</span><span class="typ" >Uri</span><span class="pun" >.</span><span class="pln" >parse</span><span class="pun" >(</span><span class="str" >&quot;0000000000&quot;</span><span class="pun" >));</span><span class="pln" > </span><span class="kwd" >try</span><span class="pun" >{</span><span class="pln" > startActivity</span><span class="pun" >(</span><span class="kwd" >in</span><span class="pun" >);</span><span class="pln" > </span><span class="pun" >}</span><span class="pln" > </span><span class="kwd" >catch</span><span class="pln" > </span><span class="pun" >(</span><span class="pln" >android</span><span class="pun" >.</span><span class="pln" >content</span><span class="pun" >.</span><span class="typ" >ActivityNotFoundException</span><span class="pln" > ex</span><span class="pun" >){</span><span class="pln" > </span><span class="typ" >Toast</span><span class="pun" >.</span><span class="pln" >makeText</span><span class="pun" >(</span><span class="pln" >getApplicationContext</span><span class="pun" >(),</span><span class="str" >&quot;yourActivity is not founded&quot;</span><span class="pun" >,</span><span class="typ" >Toast</span><span class="pun" >.</span><span class="pln" >LENGTH_SHORT</span><span class="pun" >).</span><span class="pln" >show</span><span class="pun" >();</span><span class="pln" > </span><span class="pun" >}</span><span class="pln" > </span><span class="pun" >}</span><span class="pln" > </span><span class="lit" >@Override</span><span class="pln" > </span><span class="kwd" >public</span><span class="pln" > </span><span class="kwd" >boolean</span><span class="pln" > onCreateOptionsMenu</span><span class="pun" >(</span><span class="typ" >Menu</span><span class="pln" > menu</span><span class="pun" >)</span><span class="pln" > </span><span class="pun" >{</span><span class="pln" > </span><span class="com" >// Inflate the menu; this adds items to the action bar if it is present.</span><span class="pln" > getMenuInflater</span><span class="pun" >().</span><span class="pln" >inflate</span><span class="pun" >(</span><span class="pln" >R</span><span class="pun" >.</span><span class="pln" >menu</span><span class="pun" >.</span><span class="pln" >menu_main</span><span class="pun" >,</span><span class="pln" > menu</span><span class="pun" >);</span><span class="pln" > </span><span class="kwd" >return</span><span class="pln" > </span><span class="kwd" >true</span><span class="pun" >;</span><span class="pln" > </span><span class="pun" >}</span><span class="pln" > </span><span class="lit" >@Override</span><span class="pln" > </span><span class="kwd" >public</span><span class="pln" > </span><span class="kwd" >boolean</span><span class="pln" > onOptionsItemSelected</span><span class="pun" >(</span><span class="typ" >MenuItem</span><span class="pln" > item</span><span class="pun" >)</span><span class="pln" > </span><span class="pun" >{</span><span class="pln" > </span><span class="com" >// Handle action bar item clicks here. The action bar will</span><span class="pln" > </span><span class="com" >// automatically handle clicks on the Home/Up button, so long</span><span class="pln" > </span><span class="com" >// as you specify a parent activity in AndroidManifest.xml.</span><span class="pln" > </span><span class="kwd" >int</span><span class="pln" > id </span><span class="pun" >=</span><span class="pln" > item</span><span class="pun" >.</span><span class="pln" >getItemId</span><span class="pun" >();</span><span class="pln" > </span><span class="com" >//noinspection SimplifiableIfStatement</span><span class="pln" > </span><span class="kwd" >if</span><span class="pln" > </span><span class="pun" >(</span><span class="pln" >id </span><span class="pun" >==</span><span class="pln" > R</span><span class="pun" >.</span><span class="pln" >id</span><span class="pun" >.</span><span class="pln" >action_settings</span><span class="pun" >)</span><span class="pln" > </span><span class="pun" >{</span><span class="pln" > </span><span class="kwd" >return</span><span class="pln" > </span><span class="kwd" >true</span><span class="pun" >;</span><span class="pln" > </span><span class="pun" >}</span><span class="pln" > </span><span class="kwd" >return</span><span class="pln" > </span><span class="kwd" >super</span><span class="pun" >.</span><span class="pln" >onOptionsItemSelected</span><span class="pun" >(</span><span class="pln" >item</span><span class="pun" >);</span><span class="pln" > </span><span class="pun" >}</span><span class="pln" > </span><span class="pun" >}</span></pre> <p >Following will be the content of<b >res/layout/activity_main.xml</b>file &minus;</p> <pre class="prettyprint notranslate prettyprinted" > <span class="tag" >&lt;RelativeLayout</span><span class="pln" > </span><span class="atn" >xmlns:android</span><span class="pun" >=</span><span class="atv" >&quot;http://schemas.android.com/apk/res/android&quot;</span><span class="pln" > </span><span class="atn" >xmlns:tools</span><span class="pun" >=</span><span class="atv" >&quot;http://schemas.android.com/tools&quot;</span><span class="pln" > </span><span class="atn" >android:layout_width</span><span class="pun" >=</span><span class="atv" >&quot;match_parent&quot;</span><span class="pln" > </span><span class="atn" >android:layout_height</span><span class="pun" >=</span><span class="atv" >&quot;match_parent&quot;</span><span class="pln" > </span><span class="atn" >android:paddingLeft</span><span class="pun" >=</span><span class="atv" >&quot;@dimen/activity_horizontal_margin&quot;</span><span class="pln" > </span><span class="atn" >android:paddingRight</span><span class="pun" >=</span><span class="atv" >&quot;@dimen/activity_horizontal_margin&quot;</span><span class="pln" > </span><span class="atn" >android:paddingTop</span><span class="pun" >=</span><span class="atv" >&quot;@dimen/activity_vertical_margin&quot;</span><span class="pln" > </span><span class="atn" >android:paddingBottom</span><span class="pun" >=</span><span class="atv" >&quot;@dimen/activity_vertical_margin&quot;</span><span class="pln" > </span><span class="atn" >tools:context</span><span class="pun" >=</span><span class="atv" >&quot;.MainActivity&quot;</span><span class="tag" >&gt;</span><span class="pln" > </span><span class="tag" >&lt;TextView</span><span class="pln" > </span><span class="atn" >android:layout_width</span><span class="pun" >=</span><span class="atv" >&quot;wrap_content&quot;</span><span class="pln" > </span><span class="atn" >android:layout_height</span><span class="pun" >=</span><span class="atv" >&quot;wrap_content&quot;</span><span class="pln" > </span><span class="atn" >android:text</span><span class="pun" >=</span><span class="atv" >&quot;Drag and Drop Example&quot;</span><span class="pln" > </span><span class="atn" >android:id</span><span class="pun" >=</span><span class="atv" >&quot;@+id/textView&quot;</span><span class="pln" > </span><span class="atn" >android:layout_alignParentTop</span><span class="pun" >=</span><span class="atv" >&quot;true&quot;</span><span class="pln" > </span><span class="atn" >android:layout_centerHorizontal</span><span class="pun" >=</span><span class="atv" >&quot;true&quot;</span><span class="pln" > </span><span class="atn" >android:textSize</span><span class="pun" >=</span><span class="atv" >&quot;30dp&quot;</span><span class="pln" > </span><span class="tag" >/&gt;</span><span class="pln" > </span><span class="tag" >&lt;TextView</span><span class="pln" > </span><span class="atn" >android:layout_width</span><span class="pun" >=</span><span class="atv" >&quot;wrap_content&quot;</span><span class="pln" > </span><span class="atn" >android:layout_height</span><span class="pun" >=</span><span class="atv" >&quot;wrap_content&quot;</span><span class="pln" > </span><span class="atn" >android:text</span><span class="pun" >=</span><span class="atv" >&quot;Tutorials Point&quot;</span><span class="pln" > </span><span class="atn" >android:id</span><span class="pun" >=</span><span class="atv" >&quot;@+id/textView2&quot;</span><span class="pln" > </span><span class="atn" >android:layout_below</span><span class="pun" >=</span><span class="atv" >&quot;@+id/textView&quot;</span><span class="pln" > </span><span class="atn" >android:layout_centerHorizontal</span><span class="pun" >=</span><span class="atv" >&quot;true&quot;</span><span class="pln" > </span><span class="atn" >android:textSize</span><span class="pun" >=</span><span class="atv" >&quot;30dp&quot;</span><span class="pln" > </span><span class="atn" >android:textColor</span><span class="pun" >=</span><span class="atv" >&quot;#ff14be3c&quot;</span><span class="pln" > </span><span class="tag" >/&gt;</span><span class="pln" > </span><span class="tag" >&lt;ImageView</span><span class="pln" > </span><span class="atn" >android:layout_width</span><span class="pun" >=</span><span class="atv" >&quot;wrap_content&quot;</span><span class="pln" > </span><span class="atn" >android:layout_height</span><span class="pun" >=</span><span class="atv" >&quot;wrap_content&quot;</span><span class="pln" > </span><span class="atn" >android:id</span><span class="pun" >=</span><span class="atv" >&quot;@+id/imageView&quot;</span><span class="pln" > </span><span class="atn" >android:src</span><span class="pun" >=</span><span class="atv" >&quot;@drawable/abc&quot;</span><span class="pln" > </span><span class="atn" >android:layout_marginTop</span><span class="pun" >=</span><span class="atv" >&quot;48dp&quot;</span><span class="pln" > </span><span class="atn" >android:layout_below</span><span class="pun" >=</span><span class="atv" >&quot;@+id/textView2&quot;</span><span class="pln" > </span><span class="atn" >android:layout_centerHorizontal</span><span class="pun" >=</span><span class="atv" >&quot;true&quot;</span><span class="pln" > </span><span class="tag" >/&gt;</span><span class="pln" > </span><span class="tag" >&lt;Button</span><span class="pln" > </span><span class="atn" >android:layout_width</span><span class="pun" >=</span><span class="atv" >&quot;wrap_content&quot;</span><span class="pln" > </span><span class="atn" >android:layout_height</span><span class="pun" >=</span><span class="atv" >&quot;wrap_content&quot;</span><span class="pln" > </span><span class="atn" >android:text</span><span class="pun" >=</span><span class="atv" >&quot;Call&quot;</span><span class="pln" > </span><span class="atn" >android:id</span><span class="pun" >=</span><span class="atv" >&quot;@+id/button&quot;</span><span class="pln" > </span><span class="atn" >android:layout_below</span><span class="pun" >=</span><span class="atv" >&quot;@+id/imageView&quot;</span><span class="pln" > </span><span class="atn" >android:layout_alignRight</span><span class="pun" >=</span><span class="atv" >&quot;@+id/textView2&quot;</span><span class="pln" > </span><span class="atn" >android:layout_alignEnd</span><span class="pun" >=</span><span class="atv" >&quot;@+id/textView2&quot;</span><span class="pln" > </span><span class="atn" >android:layout_marginTop</span><span class="pun" >=</span><span class="atv" >&quot;54dp&quot;</span><span class="pln" > </span><span class="atn" >android:layout_alignLeft</span><span class="pun" >=</span><span class="atv" >&quot;@+id/imageView&quot;</span><span class="pln" > </span><span class="atn" >android:layout_alignStart</span><span class="pun" >=</span><span class="atv" >&quot;@+id/imageView&quot;</span><span class="pln" > </span><span class="tag" >/&gt;</span><span class="pln" > </span><span class="tag" >&lt;/RelativeLayout&gt;</span></pre> <p >Following will be the content of<b >res/values/strings.xml</b>to define two new constants &minus;</p> <pre class="prettyprint notranslate prettyprinted" > <span class="pun" >&lt;?</span><span class="pln" >xml version</span><span class="pun" >=</span><span class="str" >&quot;1.0&quot;</span><span class="pln" > encoding</span><span class="pun" >=</span><span class="str" >&quot;utf-8&quot;</span><span class="pun" >?&gt;</span><span class="pln" > </span><span class="tag" >&lt;resources&gt;</span><span class="pln" > </span><span class="tag" >&lt;string</span><span class="pln" > </span><span class="atn" >name</span><span class="pun" >=</span><span class="atv" >&quot;app_name&quot;</span><span class="tag" >&gt;</span><span class="pln" >My Application</span><span class="tag" >&lt;/string&gt;</span><span class="pln" > </span><span class="tag" >&lt;string</span><span class="pln" > </span><span class="atn" >name</span><span class="pun" >=</span><span class="atv" >&quot;hello_world&quot;</span><span class="tag" >&gt;</span><span class="pln" >Hello world!</span><span class="tag" >&lt;/string&gt;</span><span class="pln" > </span><span class="tag" >&lt;string</span><span class="pln" > </span><span class="atn" >name</span><span class="pun" >=</span><span class="atv" >&quot;action_settings&quot;</span><span class="tag" >&gt;</span><span class="pln" >Settings</span><span class="tag" >&lt;/string&gt;</span><span class="pln" > </span><span class="tag" >&lt;/resources&gt;</span></pre> <p >Following is the default content of<b >AndroidManifest.xml</b>&minus;</p> <pre class="prettyprint notranslate prettyprinted" > <span class="pun" >&lt;?</span><span class="pln" >xml version</span><span class="pun" >=</span><span class="str" >&quot;1.0&quot;</span><span class="pln" > encoding</span><span class="pun" >=</span><span class="str" >&quot;utf-8&quot;</span><span class="pun" >?&gt;</span><span class="pln" > </span><span class="tag" >&lt;manifest</span><span class="pln" > </span><span class="atn" >xmlns:android</span><span class="pun" >=</span><span class="atv" >&quot;http://schemas.android.com/apk/res/android&quot;</span><span class="pln" > </span><span class="atn" >package</span><span class="pun" >=</span><span class="atv" >&quot;com.example.saira_000.myapplication&quot;</span><span class="pln" > </span><span class="atn" >android:versionCode</span><span class="pun" >=</span><span class="atv" >&quot;1&quot;</span><span class="pln" > </span><span class="atn" >android:versionName</span><span class="pun" >=</span><span class="atv" >&quot;1.0&quot;</span><span class="pln" > </span><span class="tag" >&gt;</span><span class="pln" > </span><span class="tag" >&lt;uses-permission</span><span class="pln" > </span><span class="atn" >android:name</span><span class="pun" >=</span><span class="atv" >&quot;android.permission.CALL_PHONE&quot;</span><span class="pln" > </span><span class="tag" >/&gt;</span><span class="pln" > </span><span class="tag" >&lt;uses-permission</span><span class="pln" > </span><span class="atn" >android:name</span><span class="pun" >=</span><span class="atv" >&quot;android.permission.READ_PHONE_STATE&quot;</span><span class="pln" > </span><span class="tag" >/&gt;</span><span class="pln" > </span><span class="tag" >&lt;application</span><span class="pln" > </span><span class="atn" >android:allowBackup</span><span class="pun" >=</span><span class="atv" >&quot;true&quot;</span><span class="pln" > </span><span class="atn" >android:icon</span><span class="pun" >=</span><span class="atv" >&quot;@drawable/ic_launcher&quot;</span><span class="pln" > </span><span class="atn" >android:label</span><span class="pun" >=</span><span class="atv" >&quot;@string/app_name&quot;</span><span class="pln" > </span><span class="atn" >android:theme</span><span class="pun" >=</span><span class="atv" >&quot;@style/AppTheme&quot;</span><span class="pln" > </span><span class="tag" >&gt;</span><span class="pln" > </span><span class="tag" >&lt;activity</span><span class="pln" > </span><span class="atn" >android:name</span><span class="pun" >=</span><span class="atv" >&quot;com.example.saira_000.myapplication.MainActivity&quot;</span><span class="pln" > </span><span class="atn" >android:label</span><span class="pun" >=</span><span class="atv" >&quot;@string/app_name&quot;</span><span class="pln" > </span><span class="tag" >&gt;</span><span class="pln" > </span><span class="tag" >&lt;intent-filter&gt;</span><span class="pln" > </span><span class="tag" >&lt;action</span><span class="pln" > </span><span class="atn" >android:name</span><span class="pun" >=</span><span class="atv" >&quot;android.intent.action.MAIN&quot;</span><span class="pln" > </span><span class="tag" >/&gt;</span><span class="pln" > </span><span class="tag" >&lt;category</span><span class="pln" > </span><span class="atn" >android:name</span><span class="pun" >=</span><span class="atv" >&quot;android.intent.category.LAUNCHER&quot;</span><span class="pln" > </span><span class="tag" >/&gt;</span><span class="pln" > </span><span class="tag" >&lt;/intent-filter&gt;</span><span class="pln" > </span><span class="tag" >&lt;/activity&gt;</span><span class="pln" > </span><span class="tag" >&lt;/application&gt;</span><span class="pln" > </span><span class="tag" >&lt;/manifest&gt;</span></pre> <p >Let&#39;s try to run your<b >My Application</b>application. I assume you have connected your actual Android Mobile device with your computer. To run the app from Android studio, open one of your project&#39;s activity files and click Run<img alt="Eclipse Run Icon" class="inline" src="http://www.tutorialspoint.com/android/images/eclipse_run.jpg" />icon from the toolbar. Before starting your application, Android studio installer will display following window to select an option where you want to run your Android application.</p> <p><img alt="Android Mobile Device" src="http://www.tutorialspoint.com/android/images/choose_device.jpg" /></p> <p >Select your mobile device as an option and then check your mobile device which will display following screen &minus;</p> <p><img alt="Android Mobile Call Screen" src="http://www.tutorialspoint.com/android/images/call12.jpg" /></p> <p >Now use<b >Call</b>button to make phone call as shown below:</p> <p><img alt="Android Mobile Call Progress" src="http://www.tutorialspoint.com/android/images/call2.jpg" /></p> <div></div>
RangeTime:0.006379s
RangeMem:231.52 KB
返回顶部 留言