I add : @Override public void onResume() { super.onResume();
telephone.listen (psl, android.telephony.PhoneStateListener.LISTEN_SERVICE_STATE); } @Override public void onDestroy() { telephone.listen (psl, android.telephony.PhoneStateListener.LISTEN_NONE); } but still ... i tried everything and compared parts of my program with solutions i found on this group and i don't understand why this doesn't work !!! On May 26, 3:41 pm, "Mark Murphy" <mmur...@commonsware.com> wrote: > > As Bnet above, i'm trying to write a program whichs detects the > > different states of the phone and mke a different noise in each case. > > There is a problem that i really don't understand!!!!! > > Please someone can take a look at it and try to explain to ma what's > > wrong ? > > 1. You have created a PhoneStateListener and then have done nothing with > it. Please look at TelephonyManager#listen() in the documentation. > > 2. You are not cleaning up the MediaPlayer objects you are creating, which > might be bad. > > 3. You are not unregistering your PhoneStateListener when your activity > closes (e.g., in onDestroy()). > > There may be other issues -- those three come to mind for me. > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > _The Busy Coder's Guide to Android Development_ Version 2.0 Available! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---