简体   繁体   中英

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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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