When i click on ringtonePreference it open a dialog with list of ringtones.But I want to open my custom dialog when click on preference instead of default dialog. Anyone help me with code sample.
My preference xml for ringtonePreference -
<RingtonePreference
android:key="@string/pref_key_sound_for_call"
android:title="@string/text_title_sound_for_call"
android:summary="@string/text_summery_sound_for_call" />
And SettingsFragment for opening my custom dialog -
preferenceForCustomSoudCall.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
showInAppPurchaseDialog();
return true;
}
});
But I want to open my custom dialog when click on preference instead of default dialog
Then do not use a RingtonePreference
. Use a Preference
, and register your click handler as you have in the question. Or, create a custom DialogPreference
, rather than displaying the entire dialog yourself.