prasad.gai prasad.gai - 1 year ago 103
Android Question

make a phone call click on a button

i am a new programer in android application

i have created a button in my application, when i clicked on a button then i would like to make a call.i have written code as follows

((Button)findViewById( OnClickListener() {
public void onClick(View v) {
String phno="10digits";

Intent i=new Intent(Intent.ACTION_DIAL,Uri.parse(phno));

when i run this application it is displaying button,when i clicked on button then i am getting force close error.the error showing in log cat as follows

03-23 15:04:16.166: ERROR/AndroidRuntime(1021): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.CALL dat=9392438004 }

how can i resolve this problem...

please help me

thanks in advance

Answer Source

Have you given the permission in the manifest file

 <uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>   

and inside your activity

  Intent callIntent = new Intent(Intent.ACTION_CALL);

Let me know if you find any issue.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download