Androidx Preferences not incuding RingtonePreference
Asked Answered
D

1

7

I'm doing the settings activity for my app via code since the xml editor wont find any preferences but PreferenceScreen. Via code everything is working but I can not find the RingtonePreferences from Androidx, the only one I find is the one from android.preference.RingtonePreference.

I have this implementation.

implementation "androidx.preference:preference:1.1.0-alpha02"

RingtonePreference has not been added yet? or there is another preference under another name I can use in order to let users choose a notification sound. Thanks!

Dao answered 12/1, 2019 at 11:48 Comment(0)
I
8

RingtonePreference has not been added yet?

Google has stated that their libraries will not support RingtonePreference.

or there is another preference under another name I can use in order to let users choose a notification sound

Use a ListPreference. Or use this workaround. Or create a custom Preference that integrates with the ringtone APIs.

Improbability answered 12/1, 2019 at 11:53 Comment(4)
Did anybody dare to implement such a custom preference? As far as I understand they wanted to avoid "some awkward plumbing". The workaround is helpful but the preference summary does not get updated.Stylographic
@yasd: I haven't seen one, though creating one using this library ought to be relatively easy.Improbability
changed <RingtonePreference to <Preference with android:key="@string/pref_notification_sound" but preference.getKey() = null. Any ideas?Bink
@JimClermonts: I recommend that you ask a separate Stack Overflow question where you can provide a minimal reproducible example.Improbability

© 2022 - 2025 — McMap. All rights reserved.