Asking Permission to Place a CallFigure 61. The DialerStep #7: Make the Call.......................................................................
Suppose we want to take advantage of the CALL_PHONE permission we
requested earlier in this tutorial. All that we need to do is switch our Intent
from ACTION_DIAL to ACTION_CALL:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId()==R.id.call) {
String toDial="tel:"+phone.getText().toString();if (toDial.length()> 4 ) {
startActivity(new Intent(Intent.ACTION_CALL,
Uri.parse(toDial)));return(true);
}
}return(super.onOptionsItemSelected(item));
}