java – How to use class extends List Preference-ThrowExceptions

Exception or error:

I’m trying to make a change of features in ListPreference.
So I made a legacy of Kelas from this list, but I don’t know how I can use it to change the title of the list, change some color and do some other things.

public class ThemedListPreference extends ListPreference implements AdapterView.OnItemClickListener {

    public static final String TAG = "ThemedListPreference";

    private int mClickedDialogEntryIndex;

    private CharSequence mDialogTitle;

    public ThemedListPreference(Context context , AttributeSet attrs){

        super(context , attrs);

    public ThemedListPreference(Context context) {

    public void setLayoutResource(int layoutResId) {

    public void onItemClick(AdapterView<?> parent , View view , int position , long id) {

How to solve:


This class was deprecated in API level 29.

If you want to make changes. You have to return true from your onPreferenceChangeListener.

PreferenceChangeListener document

This interface was deprecated in API level 29.

mPreferenceChange.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        return true;

Leave a Reply

Your email address will not be published. Required fields are marked *