[英]Using intent.Action_call for user inputted number
Help me modify with necessary changes needed to use the value/string(number) passed by user for phone-calling that string itself 帮助我修改必要的更改,以使用用户传递的值/字符串(数字)来调用该字符串本身
Intent phnIntent = new Intent(Intent.ACTION_CALL);
phnIntent.setData(Uri.parse("tel:+91987654321"));
Make sure you add the necessary permission in the Android Manifest. 确保您在Android清单中添加了必要的权限。
<uses-permission android:name="android.permission.CALL_PHONE" />
Just add the line startActivity(phnIntent);
只需添加行
startActivity(phnIntent);
EDIT: 编辑:
Activity A 活动A
Intent someIntent = new Intent(A.this, B.class);
someIntent.putExtra("phoneNumber", number);
startAcitivty(someIntent);
Acitivity B 活力B
Bundle extras = getIntent().getExtras();
String number = extras.getInt("phoneNumber");
Use the number
string to make the call. 使用
number
字符串拨打电话。
you can use like this : 您可以这样使用:
String strTelNo = "+91987654321"; 字符串strTelNo =“ +91987654321”;
Intent intent = new Intent("android.intent.action.CALL"); Intent intent = new Intent(“ android.intent.action.CALL”);
Uri data = Uri.parse("tel:"+ strTelNo ); Uri数据= Uri.parse(“ tel:” + strTelNo);
intent.setData(data); intent.setData(data);
startActivity(intent); startActivity(intent);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.