![](/img/trans.png)
[英]How to give Choice of Numbers to Call using Intent.ACTION_CALL?
[英]How to add two numbers to tel: in android Intent.ACTION_CALL?
我知道如何通过应用程序拨打电话号码。
Intent i = new Intent(Intent.ACTION_CALL,Uri.parse("tel:" + "443656566"));
startActivity(i);
很好,但是我想要的是如何在“ tel:”中添加两个数字,以便在致电之前向我展示选择器来选择其中一个数字。
任何想法如何做到这一点。
请帮忙!!!
我之前遇到过这个问题,但我解决了
得到一个微调器(如果需要,可以使它看起来像一个按钮),然后当用户喜欢它时,他可以选择在此处拨打哪个号码,代码:
Spinner spinnumber=(Spinner)findViewById(R.id.spinnum);
String[] sp2data = { "Show Numbers", "121121212", "1222121212", "2323342424"}; //you sure can put strings here
ArrayAdapter aa2 = new ArrayAdapter(this,
android.R.Layout.Simple_spinner, sp2data);
aa2.setDropDownViewResource(android.R.Layout.Simple_spinner,);
// Spinner1.setOnItemSelectedListener(this);
spinnumber.setOnItemSelectedListener(this);
spinnumber.setAdapter(aa2);
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
如果(spinnumber.getSelectedItemPosition()== 1){
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:" + "121121212"));
startActivity(callIntent);
}
else if ( spinnumber.getSelectedItemPosition()==2) {
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:" + num2));
startActivity(callIntent);
}
else if ( spinnumber.getSelectedItemPosition()==3) {
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:" + num3));
startActivity(callIntent);
}
这样尝试
Intent smsIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("tel:"
+ phNo1 + ";" + phNo2 + ";" + phNo3));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.