NullPointerException when calling RingTonePreference on Samsung Galaxy S
I am getting the following message when calling RingTonePreference on Samsung Galaxy (everything works fine on other phones):
java.lang.RuntimeException: Unable to start activity ComponentInfo{android/com.a
ndroid.internal.app.RingtonePickerActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Loo开发者_如何学Cper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:85
8)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.android.internal.app.RingtonePickerActivity.onPrepareListView(RingtonePic
kerActivity.java:252)
at com.android.internal.app.AlertController$AlertParams.createListView(AlertCont
roller.java:909)
at com.android.internal.app.AlertController$AlertParams.apply(AlertController.ja
va:824)
at com.android.internal.app.AlertActivity.setupAlert(AlertActivity.java:73)
at com.android.internal.app.RingtonePickerActivity.onCreate(RingtonePickerActivi
ty.java:226)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
... 11 more
UPDATE: Here is how it is called :
<RingtonePreference android:key="pref_notification_ringTone"
android:title="@string/pref_notification_Ringtone"
android:ringtoneType="notification" android:showDefault="true"
android:showSilent="false" />
PS : I know the a similar question has already been asked, but no answer was given (https://stackoverflow.com/questions/5428768/notification-or-alarm-sound-picker-crash-on-galaxy-s/5872352#5872352)
This issue was resolved by setting "showSilent=true" in the definition and is apparently a bug specific to the Galaxy S.
精彩评论