![](/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.