Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android: How to open the call screen and fill it with a number but do not make a call?

I could only find "how to make a call from your application" and the solution is:

EditText et = (EditText) findViewById(R.id.editText);
String s = et.getText().toString();

try {
    Intent callIntent = new Intent(Intent.ACTION_CALL);
    callIntent.setData(Uri.parse("tel:" + s));
    startActivity(callIntent);
    } catch (ActivityNotFoundException activityException) {
    Log.d("Calling a Phone Number", "Call failed" + activityException);
    }

But this directly makes a call, without confirming. Like if the number must be preceded with a 0 user must be allowed to do it and then make a call and once the call is finished he must be taken back to the application activity where he started the intent.

like image 827
Archie.bpgc Avatar asked Dec 27 '22 18:12

Archie.bpgc


1 Answers

Simply change Intent.ACTION_CALL to Intent.ACTION_VIEW in your code.

Update: To call just the phone use Intent.ACTION_DIAL, however Intent.ACTION_VIEW call messaging or phone.

like image 65
ATom Avatar answered Jan 16 '23 08:01

ATom