Methods Summary |
---|
public void | addPreferencesFromIntent(android.content.Intent intent)Adds preferences from activities that match the given {@link Intent}.
requirePreferenceManager();
setPreferenceScreen(mPreferenceManager.inflateFromIntent(intent, getPreferenceScreen()));
|
public void | addPreferencesFromResource(int preferencesResId)Inflates the given XML resource and adds the preference hierarchy to the current
preference hierarchy.
requirePreferenceManager();
setPreferenceScreen(mPreferenceManager.inflateFromResource(this, preferencesResId,
getPreferenceScreen()));
|
private void | bindPreferences()
final PreferenceScreen preferenceScreen = getPreferenceScreen();
if (preferenceScreen != null) {
preferenceScreen.bind(getListView());
}
|
public Preference | findPreference(java.lang.CharSequence key)Finds a {@link Preference} based on its key.
if (mPreferenceManager == null) {
return null;
}
return mPreferenceManager.findPreference(key);
|
public PreferenceManager | getPreferenceManager()Returns the {@link PreferenceManager} used by this activity.
return mPreferenceManager;
|
public PreferenceScreen | getPreferenceScreen()Gets the root of the preference hierarchy that this activity is showing.
return mPreferenceManager.getPreferenceScreen();
|
protected void | onActivityResult(int requestCode, int resultCode, android.content.Intent data)
super.onActivityResult(requestCode, resultCode, data);
mPreferenceManager.dispatchActivityResult(requestCode, resultCode, data);
|
public void | onContentChanged()
super.onContentChanged();
postBindPreferences();
|
protected void | onCreate(android.os.Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(com.android.internal.R.layout.preference_list_content);
mPreferenceManager = onCreatePreferenceManager();
getListView().setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
|
private PreferenceManager | onCreatePreferenceManager()Creates the {@link PreferenceManager}.
PreferenceManager preferenceManager = new PreferenceManager(this, FIRST_REQUEST_CODE);
preferenceManager.setOnPreferenceTreeClickListener(this);
return preferenceManager;
|
protected void | onDestroy()
super.onDestroy();
mPreferenceManager.dispatchActivityDestroy();
|
protected void | onNewIntent(android.content.Intent intent)
if (mPreferenceManager != null) {
mPreferenceManager.dispatchNewIntent(intent);
}
|
public boolean | onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference){@inheritDoc}
return false;
|
protected void | onRestoreInstanceState(android.os.Bundle state)
super.onRestoreInstanceState(state);
Bundle container = state.getBundle(PREFERENCES_TAG);
if (container != null) {
final PreferenceScreen preferenceScreen = getPreferenceScreen();
if (preferenceScreen != null) {
preferenceScreen.restoreHierarchyState(container);
}
}
|
protected void | onSaveInstanceState(android.os.Bundle outState)
super.onSaveInstanceState(outState);
final PreferenceScreen preferenceScreen = getPreferenceScreen();
if (preferenceScreen != null) {
Bundle container = new Bundle();
preferenceScreen.saveHierarchyState(container);
outState.putBundle(PREFERENCES_TAG, container);
}
|
protected void | onStop()
super.onStop();
mPreferenceManager.dispatchActivityStop();
|
private void | postBindPreferences()Posts a message to bind the preferences to the list view.
Binding late is preferred as any custom preference types created in
{@link #onCreate(Bundle)} are able to have their views recycled.
if (mHandler.hasMessages(MSG_BIND_PREFERENCES)) return;
mHandler.obtainMessage(MSG_BIND_PREFERENCES).sendToTarget();
|
private void | requirePreferenceManager()
if (mPreferenceManager == null) {
throw new RuntimeException("This should be called after super.onCreate.");
}
|
public void | setPreferenceScreen(PreferenceScreen preferenceScreen)Sets the root of the preference hierarchy that this activity is showing.
if (mPreferenceManager.setPreferences(preferenceScreen) && preferenceScreen != null) {
postBindPreferences();
CharSequence title = getPreferenceScreen().getTitle();
// Set the title of the activity
if (title != null) {
setTitle(title);
}
}
|