I have a RingtonePreference nested inside 2 PreferenceScreen declared as:
<PreferenceScreen
//other preferences
<PreferenceScreen
//other preferences
<RingtonePreference
android:key="ringtone"
android:title="@string/ringtone_title"
android:summary="@string/sipringtone_ringtone_summary"
android:ringtoneType="ringtone" />
/>
/>
The PreferenceFragment is nested inside a ActivityGroup as such. The path to the fragment is as followed: MainActivity(TabActivity)->Activity1(ActivityGroup)->Activity2(Activity)->PreferenceFragment
I did not write this code but am picking off where someone left off. The dialogs from clicking every preference was crashing the app because it did not like the context of Activity2. This was an ActivityGroup related issue that was resolved by forcing the context of each preference to the context of Activity1.
EditPreferences, ListPreferences, and CheckPreferences all worked as intended but RingtonePreference is giving me a lot of trouble. Although the dialog pops up to let me choose the selection of ringtones, it does not save the setting.
Selecting a ringtone from the list and pressing the OK button does not trigger onPreferenceChange() or onSharedPreferenceChanged(). I tried creating a custom RingtonePreference and overriding onSaveRingtone() but that did not get called at all. However, other methods like onPrepareRingtonePickerIntent() and onRestoreRingtone() did get called. I tried a bunch of other options that were mentioned on stack overflow but had no luck. I'm running out of ideas to get RingtonePreference to work and think starting my own ringtone picker using RingtoneManager is the best alternative. If anyone could give me some advise on how to get RingtonePreference to work then that'll be awesome.
Edit: I believe this is a context problem but I can't find out how to solve it yet.