I have a media player which i want to mute when the user gets a call. I was using the TelephonyManager to listen for calls creating the listener on create and removing it on destroy in my service. like so: public void onCreate() { ... TelephonyManager tm = (TelephonyManager)getSystemService (Context.TELEPHONY_SERVICE); mcsl = new MediaServicePhoneStateListener(); tm.listen(mcsl, PhoneStateListener.LISTEN_CALL_STATE); ... }
@Override public void onDestroy() { super.onDestroy(); ... TelephonyManager tm = (TelephonyManager)getSystemService (Context.TELEPHONY_SERVICE); tm.listen(mcsl, PhoneStateListener.LISTEN_NONE); ... } but when the phone rings i periodically get a crash in the ring app - looks like when its trying to get the photo: I/ActivityManager( 79): Low Memory: No more background processes. W/dalvikvm(17512): threadid=31: thread exiting with uncaught exception (group=0x4001da28) E/AndroidRuntime(17512): Uncaught handler: thread ContactsAsyncWorker exiting due to uncaught exception W/BinderNative(17512): Uncaught exception from death notification W/BinderNative(17512): java.lang.NullPointerException W/BinderNative(17512): at android.app.ActivityThread.removeDeadProvider(ActivityThread.java: 4045) W/BinderNative(17512): at android.app.ActivityThread $ProviderRecord.binderDied(ActivityThread.java:1158) W/BinderNative(17512): at android.os.BinderProxy.sendDeathNotice (Binder.java:345) W/BinderNative(17512): at dalvik.system.NativeStart.run(Native Method) E/AndroidRuntime(17512): java.lang.NullPointerException E/AndroidRuntime(17512): at android.provider.Contacts $People.openContactPhotoInputStream(Contacts.java:485) E/AndroidRuntime(17512): at android.pim.ContactsAsyncHelper $WorkerHandler.handleMessage(ContactsAsyncHelper.java:186) E/AndroidRuntime(17512): at android.os.Handler.dispatchMessage (Handler.java:99) E/AndroidRuntime(17512): at android.os.Looper.loop(Looper.java:123) E/AndroidRuntime(17512): at android.os.HandlerThread.run (HandlerThread.java:60) I/Process ( 79): Sending signal. PID: 17512 SIG: 3 I/dalvikvm(17512): threadid=7: reacting to signal 3 when i remove the listener the crash doesn't happen, looks like a bug to me - but does anyone know of a workaround? regards, rob http://www.my-pod.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---