I'm trying to make a call when I press a button in android
((Button)findViewById(R.id.button1)).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String phno="10digits";
Intent i=new Intent(Intent.ACTION_DIAL,Uri.parse(phno));
startActivity(i);
}
});
But when I run and click on the button it gives me the error
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?
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);
callIntent.setData(Uri.parse("tel:123456789"));
startActivity(callIntent);
Let me know if you find any issue.