简体   繁体   English

android:如何打开通话屏幕并用数字填充但不拨打电话?

[英]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. 就像数字必须以0开头一样,必须允许用户执行此操作,然后拨打电话,一旦完成调用,他必须返回到他启动意图的应用程序活动。

Simply change Intent.ACTION_CALL to Intent.ACTION_VIEW in your code. 只需在代码Intent.ACTION_CALL Intent.ACTION_VIEW更改为Intent.ACTION_CALL即可。

Update : To call just the phone use Intent.ACTION_DIAL , however Intent.ACTION_VIEW call messaging or phone. 更新 :只需拨打电话即可使用Intent.ACTION_DIAL ,无论是Intent.ACTION_VIEW还是电话短信或电话。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM