简体   繁体   English

如何在android Intent.ACTION_CALL中将两个数字加到tel:

[英]How to add two numbers to tel: in android Intent.ACTION_CALL?

I know how to call phone number from app. 我知道如何通过应用程序拨打电话号码。

  Intent i = new Intent(Intent.ACTION_CALL,Uri.parse("tel:" + "443656566"));
  startActivity(i);

This is fine but what i want is how can i add two numbers to "tel:" so that before calling i am presented with chooser to choose either one of numbers. 很好,但是我想要的是如何在“ tel:”中添加两个数字,以便在致电之前向我展示选择器来选择其中一个数字。

Any idea how can this be done. 任何想法如何做到这一点。

Please HELP!!! 请帮忙!!!

i meet this problem before but i solve it 我之前遇到过这个问题,但我解决了

get a spinner(make it looks like a button if you want) and then when user prees on it he can choose which number to dial here the code : 得到一个微调器(如果需要,可以使它看起来像一个按钮),然后当用户喜欢它时,他可以选择在此处拨打哪个号码,代码:

        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

if ( spinnumber.getSelectedItemPosition()==1) { 如果(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);

    }

try like this 这样尝试

 Intent smsIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("tel:"
            + phNo1 + ";" + phNo2 + ";" + phNo3));

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

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