user2903095
user2903095

Reputation:

Making a phone call not directly

To make a phone call, I just click on a button and I'm directly making the phone call. But I want to change that.

What I want, it's when I click on the button, I move to the composer like in this image.
Then, I can confirm ou not the call phone.

Please, can you helpe me ? This is my actual code

    buttonCall.setOnClickListener(new View.OnClickListener()
    {
        public void onClick(View view){
                Intent call = new Intent(Intent.ACTION_CALL);
                call.setData(Uri.parse("tel:" 1234567));    
                startActivity(call);
        }
    });

Upvotes: 1

Views: 522

Answers (3)

Andrew T.
Andrew T.

Reputation: 4707

Use Intent.ACTION_DIAL or Intent.ACTION_VIEW instead of Intent.ACTION_CALL.

From Intent:

ACTION_VIEW tel:123 -- Display the phone dialer with the given number filled in.

ACTION_DIAL tel:123 -- Display the phone dialer with the given number filled in.

Upvotes: 1

Graya
Graya

Reputation: 51

Use this :

Intent call = new Intent(Intent.ACTION_DIAL);

Upvotes: 0

Manishika
Manishika

Reputation: 5564

I guess you want to show the dialpad with the phone no. Use this in onClick

Intent dial = new Intent();
dial.setAction("android.intent.action.DIAL");
dial.setData(Uri.parse("tel:"+number));
startActivity(dial); 

Upvotes: 0

Related Questions