Hi all,
Since upgrading to android 13 (or maybe even 11 or 12), my app keeps crashing when it tries to launch the ringtone picker.
The stacktrace is:
E/AndroidRuntime(10313): FATAL EXCEPTION: main
E/AndroidRuntime(10313): Process: com.samsung.android.secsoundpicker, PID: 10313
E/AndroidRuntime(10313): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.samsung.android.secsoundpicker/com.samsung.android.secsoundpicker.SecSoundPickerActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
E/AndroidRuntime(10313): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4166)
E/AndroidRuntime(10313): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4312)
E/AndroidRuntime(10313): at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
E/AndroidRuntime(10313): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
E/AndroidRuntime(10313): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
E/AndroidRuntime(10313): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2571)
E/AndroidRuntime(10313): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(10313): at android.os.Looper.loopOnce(Looper.java:226)
E/AndroidRuntime(10313): at android.os.Looper.loop(Looper.java:313)
E/AndroidRuntime(10313): at android.app.ActivityThread.main(ActivityThread.java:8741)
E/AndroidRuntime(10313): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(10313): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
E/AndroidRuntime(10313): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
E/AndroidRuntime(10313): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
E/AndroidRuntime(10313): at com.samsung.android.secsoundpicker.widget.SecVolumeIcon.h(Unknown Source:18)
E/AndroidRuntime(10313): at com.samsung.android.secsoundpicker.widget.SecVolumeIcon.q(Unknown Source:14)
E/AndroidRuntime(10313): at com.samsung.android.secsoundpicker.widget.SecVolumeIcon.s(Unknown Source:3)
E/AndroidRuntime(10313): at com.samsung.android.secsoundpicker.widget.SecVolumeIcon.c(Unknown Source:43)
E/AndroidRuntime(10313): at com.samsung.android.secsoundpicker.widget.SecVolumeSeekBarView.t(Unknown Source:28)
E/AndroidRuntime(10313): at com.samsung.android.secsoundpicker.SecSoundPickerActivity.a1(Unknown Source:40)
E/AndroidRuntime(10313): at com.samsung.android.secsoundpicker.SecSoundPickerActivity.onCreate(Unknown Source:473)
E/AndroidRuntime(10313): at android.app.Activity.performCreate(Activity.java:8578)
E/AndroidRuntime(10313): at android.app.Activity.performCreate(Activity.java:8557)
E/AndroidRuntime(10313): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1384)
E/AndroidRuntime(10313): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4147)
E/AndroidRuntime(10313): ... 12 more
I am testing with S21 running android 13. I can confirm that the same code works flwalessly on S9 running Android 10. I can also confirm that the same code also works with Pixel 5 emulator running android 13.
Any idea what the cause is to this problem on S21 android 13?
I haven’t released this version of my application yet. It’s still in testing phase, and this is an issue that I came across while migrating the targetSdk to 33 (Android 13).
But as you can see I included the stacktrace. It should be pretty easy to see where the issue is. There is a NullPointerException being thrown in SecVolumeIcon.h in line number 18. I believe this is Samsung’s code.
Can it be that Samsung’s code is expecting some data/information which is not passed in to the Intent object? Below is the piece of code that I use to start the Activity:
void startAlarmTonePickerActivity(@NonNull MethodChannel.Result methodChannelResult, @Nullable String currentUri) {
Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_ALARM);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, "Select alarm tone");
if (currentUri != null) {
Uri alarmTone = Uri.parse(currentUri);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, alarmTone);
}
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, false);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
Log.v(TAG, "Sending intent " + intent);
if (activity != null) {
try {
activity.startActivityForResult(intent, ALARM_PICKER_REQUEST_CODE);
this.methodChannelResult = methodChannelResult;
} catch (Exception e) {
Log.e(TAG, "Failed to open alarm picker", e);
methodChannelResult.error("PICK_ERR", "Exception while opening alarm picker", e.getMessage());
}
} else {
Log.w(TAG, "Trying to start intent without activity");
methodChannelResult.error("PICK_ERR", "Cannot start alarm picker without Activity", null);
}
}
I had the same issue in my app in OS 13. The issue is caused when setting the intent extra RingtoneManager.EXTRA_RINGTONE_TYPE to RingtoneManager.TYPE_ALARM. If you change it to RingtoneManager.TYPE_RINGTONE or RingtoneManager.TYPE_ALL, it should work.
Hello…I’m brand new to these forums, and I’ve only now just finished creating my account…having purchased just of recent (about 4 weeks ago), a brand new Samsung Galaxy A14 5G smartphone, which was only released into the public domain in January 2023, it too has suddenly developed Ringtone changing problems, AND it’s NOT even 1 year old yet.
I have found the app thats needed to be re-installed into the phone, and I can download it onto the phone itself to, but I need advice and help on how to successfully re-install it…
The phone comes with a built in “Maintenance Section”, where you first need to create a PIN Number, after which, ALL my Photo’s and Video’s, and various apps to, are ALL HIDDEN from view, so NOBODY who gets access to it, will see what they are.
ONLY the essential apps are left visible to see, everything else IS COMPLETELY HIDDEN…So if anyone can help me and show me how to re-install it, I would be very appreciated with thanks.
Hello Chris,
This does not seem to be a development related issue. I think you will receive better support for usage related issues through the Samsung Members application.