如何在tel中添加两个数字:在android Intent.ACTION_CALL中?

时间:2013-10-10 13:22:03

标签: android android-intent

我知道如何从应用中拨打电话号码。

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

这很好但我想要的是如何将两个数字添加到“tel:”以便在调用之前我会选择选择其中一个数字。

知道如何做到这一点。

请帮助!!!

2 个答案:

答案 0 :(得分:1)

我之前遇到过这个问题,但我解决了这个问题

得到一个微调器(如果你想要它看起来像一个按钮)然后当用户在它上面做时他可以选择拨打哪个号码 这里是代码:

        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){

        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);

    }

答案 1 :(得分:-1)

试试这个

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