user1287195
user1287195

Reputation: 19

How to launch an activity on phone call end?

I have an app that allows the user to lend their phone to people who ask to use their phones for a phone call. It works with a EditText and Button.

Here's the phone call code:

button1 = (Button)findViewById(R.id.button1);
    setEditText1((EditText)findViewById(R.id.editText1));
    button1.setOnClickListener(this); {}}


            public void onClick(View arg0) {

                EditText num=(EditText)findViewById(R.id.editText1);
                String number = "tel:" +num.getText().toString().trim();
                Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse(number));
                startActivity(callIntent);
            }

What I want to do is make it so that when the guest ends their phone call, it goes to a password activity. How can I do this?

Upvotes: 0

Views: 616

Answers (1)

HexAndBugs
HexAndBugs

Reputation: 5799

You can use the TelephonyManager and PhoneStateListener and override onCallStateChanged so that you start your activity when the state changes to CALL_STATE_IDLE.

Upvotes: 1

Related Questions