D
D
Dmitry Richter2014-07-03 02:34:16
Android
Dmitry Richter, 2014-07-03 02:34:16

How to give a choice to the user of the program from which SIM card to call?

I wrote a small program, when I press the button, it calls the number, and everything would be fine in this fairy tale, but I checked it on a friend’s phone and when I pressed it, it just flew out of the program, only then I remembered that he had a dual sim. So how to put that would the SIM card be 1 or 2 as standard when the program was launched? Or would it be possible for the user to choose from which SIM card to call him?
I tried to use getDeviceId (), writes that "Non-static method ...".
Here is the part of the code I use to make the call:

final Intent calling1 = new Intent(Intent.ACTION_CALL);
        call1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                calling1.setData(Uri.parse("tel:5555"));
                startActivity(calling1);
            }
        });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tarikb, 2014-07-10
@tarikb

You can try Intent.ACTION_DIAL instead of ACTION_CALL . the dialer with the entered number will be called. I have it like this in my code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question