I have some reports of crash of my app that I don't understand, for the 
moment the crash seems limited to Galaxy Nexus with 4.1.1.

java.lang.NullPointerException
> at android.media.AudioManager.<init>(AudioManager.java:413)
> at android.app.ContextImpl$6.createService(ContextImpl.java:289)
> at android.app.ContextImpl$ServiceFetcher.getService(ContextImpl.java:207)
> at android.app.ContextImpl.getSystemService(ContextImpl.java:1250)
> at android.content.ContextWrapper.getSystemService(ContextWrapper.java:416)
> at 
> org.leetzone.android.yatsewidget.YatseApplication.onCreate(SourceFile:281)
> at 
> android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:999)
> at android.app.LoadedApk.makeApplication(LoadedApk.java:511)
> at android.app.ActivityThread.handleReceiver(ActivityThread.java:2216)
> at android.app.ActivityThread.access$1500(ActivityThread.java:130)
> at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1271)
> at android.os.Handler.dispatchMessage(Handler.java:99)
> at android.os.Looper.loop(Looper.java:137)
> at android.app.ActivityThread.main(ActivityThread.java:4745)
> at java.lang.reflect.Method.invokeNative(Native Method)
> at java.lang.reflect.Method.invoke(Method.java:511)
> at 
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
> at dalvik.system.NativeStart.main(Native Method)


The line 281 of my code is a simple :

mAudioManager = (AudioManager) getSystemService(AUDIO_SERVICE);


This should return null if for some reason the service is not available but 
from what I understand it's not possible for this function to throw an NPE.

Is this a Nexus bug or is there something I missed and should take care of 
when using getSystemService ?

Regards,
Tolriq.




-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to