make a phone call click on a button

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?

50
задан Vadim Kotov 18 August 2017 в 02:08
поделиться