In my Android application, I have implemented class SubtitleColorListPreference
which extends from ListPreference
. I need this, because I need to set my own layout for each item in list. Everything works fine and it looks like this:
The important code is in method onPrepareDialogBuilder(AlertDialog.Builder builder)
, where I set my own ListAdapter
.
@Override
protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
// some other code is here ...
ListAdapter listAdapter = new SubtitleColorAdapter(getContext(), R.layout.subtitle_color_preference_item, colorNameHolders, index, this);
builder.setAdapter(listAdapter, this);
}
Now, I need to use PreferenceFragmentCompat
instead of PreferenceFragment
, so my SubtitleColorListPreference
has to extend android.support.v7.preference.ListPreference
. And here is the problem - there are no onPrepareDialogBuilder
method in this ListPreference
. Also, I did not find any similar method. I tried to find some examples how to create custom android.support.v7.preference.ListPreference
, but with no success.
Does anybody know how can I solve this?