Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
added in version 1.0.0
belongs to Maven artifact androidx.preference:preference:1.0.0-rc01

PreferenceGroup.PreferencePositionCallback

public static interface PreferenceGroup.PreferencePositionCallback

androidx.preference.PreferenceGroup.PreferencePositionCallback


Interface for PreferenceGroup Adapters to implement so that PreferenceFragment.scrollToPreference(String) and PreferenceFragment.scrollToPreference(Preference) or PreferenceFragmentCompat.scrollToPreference(String) and PreferenceFragmentCompat.scrollToPreference(Preference) can determine the correct scroll position to request.

Summary

Public methods

abstract int getPreferenceAdapterPosition(Preference preference)

Return the adapter position of the specified Preference object

abstract int getPreferenceAdapterPosition(String key)

Return the adapter position of the first Preference with the specified key

Public methods

getPreferenceAdapterPosition

added in version 1.0.0
public abstract int getPreferenceAdapterPosition (Preference preference)

Return the adapter position of the specified Preference object

Parameters
preference Preference: Preference object to find

Returns
int Adapter position of the Preference or RecyclerView.NO_POSITION if not found

getPreferenceAdapterPosition

added in version 1.0.0
public abstract int getPreferenceAdapterPosition (String key)

Return the adapter position of the first Preference with the specified key

Parameters
key String: Key of Preference to find

Returns
int Adapter position of the Preference or RecyclerView.NO_POSITION if not found