androidsharedpreferencesandroid-8.0-oreoseekbarpreference

implementing SeekBarPreference


I'm having trouble implementing SeekBarPreference in a class.

https://developer.android.com/reference/android/support/v7/preference/SeekBarPreference.html

As you see this SeekBarPreference is available in 25.1.0 and I implemented it in xml and UI looks fine. I need to save the value of this seekbar in default shared preferences. That is where I'm having the issue, there isn't an import option for android.support.v7.preference.SeekBarPreference. Is it unused now?

I updated my app to have 26.0.1 and tried manually added the import but it's not setting in. Any suggestions?


Solution

  • you need to include the preference-v7 library in your dependencies

    compile 'com.android.support:preference-v7:26.0.0'
    

    and then you will be able to import the class with

    import android.support.v7.preference.SeekBarPreference;
    

    if your're compiling with sdk version 26, support library version should be 26.0.0, at the moment this is the latest version. 26.0.1 doesn't seem to exist