Hi All, I am kind of stuck in this problem any help would be really appreciated. Here is the scenario.
I run the phone call intent in a loop with PhoneListener. Here are the steps: 1) Start the phone call intent and wait for the phonestatelistener to come to idle state 2) Once the phone state listener is idle, dial another number and continue this activity in a sort of loop. Now, I would like to spawn an new child activity as soon as phonestatelistener gives me idle state and make some changes. As soon as the child activity work is done, I would like to resume the dialing with the next number like what is happening now. I have tried all possible ways, but I am not able to bring the child activity and loop continues. If I press the back button and stop the dialer, my child activity now shows up, but I would like to show it after the first dialed number and before the second number to be dialed. Please let me know if there is a solution to it: Here is the code snippet: Phone Call: (I am removing code that does not needed to shown) Intent i = new Intent(Intent.ACTION_CALL, Uri.parse("tel:"+phoneNumber)); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); Phome StateListener: Pls see the code after comment //Prospect the call here I want to initiate actvity by calling finction UpdateContact(c) public class MyPhoneStateListener extends PhoneStateListener { boolean called = false; @Override public void onCallStateChanged(int state, String incomingNumber) { super.onCallStateChanged(state, incomingNumber); try { switch(state){ case TelephonyManager.CALL_STATE_IDLE: Log.d("DEBUG", "IDLE"); //Check if there is a stop requested if ( status == Constants.Stopped) { stopListening(); Log.d("DEBUG", "STOP-LISTENINIG"); } else { if (called && state == TelephonyManager.CALL_STATE_IDLE) { called = false; stopListening(); //Prospect the call here if (prospectEachCall) UpdateContact(c); //This is where I want new actvity to start //ctx1.startActivity(new Intent("UpdateContact.class")); if ( c.moveToNext() ) { //startActivity(new Intent(AllContacts.this, AllContacts.class)); Log.d("DEBUG", "START-CALLING"); startCalling (c); } } } break; case TelephonyManager.CALL_STATE_OFFHOOK: Log.d("DEBUG", "OFFHOOK"); //Do nothing called = true; break; case TelephonyManager.CALL_STATE_RINGING: Log.d("DEBUG", "RINGING"); called = true; break; } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en