Hi all, I'm tring to catch events from phone calls. For some reason the event "state changed" happens only when the main activity is started. After that I'm trying to simulate the call using eclipse DDMS tool but unsucessfully. Should I listen in background thread instead?
What is wron with following code? public class main extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TelephonyManager myPhoneManager = (TelephonyManager)getSystemService (Context.TELEPHONY_SERVICE); PhoneStateListener myPhoneListener = new PhoneStateListener() { public void onCallStateChanged(int state, String phoneNumber) { TextView tv = (TextView)findViewById (R.id.phone_interaction); tv.setText(String.valueOf(Calendar.getInstance ().getTimeInMillis())); } }; myPhoneManager.listen(myPhoneListener, PhoneStateListener.LISTEN_CALL_STATE); } } Thanks in advance, Evgeny --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---