public abstract class PreferenceActivity extends ListActivity implements PreferenceFragment.OnPreferenceStartFragmentCallback
Build.VERSION_CODES.HONEYCOMB
this class only allowed the display of a single set of preference; this
functionality should now be found in the new PreferenceFragment
class. If you are using PreferenceActivity in its old mode, the documentation
there applies to the deprecated APIs here.
This activity shows one or more headers of preferences, each of which
is associated with a PreferenceFragment
to display the preferences
of that header. The actual layout and display of these associations can
however vary; currently there are two major approaches it may take:
Subclasses of PreferenceActivity should implement
onBuildHeaders(java.util.List<android.preference.PreferenceActivity.Header>)
to populate the header list with the desired
items. Doing this implicitly switches the class into its new "headers
+ fragments" mode rather than the old style of just showing a single
preferences list.
For information about using PreferenceActivity
,
read the Settings
guide.
The following sample code shows a simple preference activity that has two different sets of preferences. The implementation, consisting of the activity itself as well as its two preference fragments is:
The preference_headers resource describes the headers to be displayed and the fragments associated with them. It is:
The first header is shown by Prefs1Fragment, which populates itself from the following XML resource:
Note that this XML resource contains a preference screen holding another fragment, the Prefs1FragmentInner implemented here. This allows the user to traverse down a hierarchy of preferences; pressing back will pop each fragment off the stack to return to the previous preferences.
See PreferenceFragment
for information on implementing the
fragments themselves.
Modifier and Type | Class and Description |
---|---|
static class |
PreferenceActivity.Header
Description of a single Header item that the user can select.
|
Modifier and Type | Field and Description |
---|---|
static String |
EXTRA_NO_HEADERS
When starting this activity, the invoking Intent can contain this extra
boolean that the header list should not be displayed.
|
static String |
EXTRA_SHOW_FRAGMENT
When starting this activity, the invoking Intent can contain this extra
string to specify which fragment should be initially displayed.
|
static String |
EXTRA_SHOW_FRAGMENT_ARGUMENTS
When starting this activity and using
EXTRA_SHOW_FRAGMENT ,
this extra can also be specified to supply a Bundle of arguments to pass
to that fragment when it is instantiated during the initial creation
of PreferenceActivity. |
static String |
EXTRA_SHOW_FRAGMENT_SHORT_TITLE
When starting this activity and using
EXTRA_SHOW_FRAGMENT ,
this extra can also be specify to supply the short title to be shown for
that fragment. |
static String |
EXTRA_SHOW_FRAGMENT_TITLE
When starting this activity and using
EXTRA_SHOW_FRAGMENT ,
this extra can also be specify to supply the title to be shown for
that fragment. |
static long |
HEADER_ID_UNDEFINED
Default value for
Header.id indicating that no
identifier value is set. |
mAdapter, mList
DEFAULT_KEYS_DIALER, DEFAULT_KEYS_DISABLE, DEFAULT_KEYS_SEARCH_GLOBAL, DEFAULT_KEYS_SEARCH_LOCAL, DEFAULT_KEYS_SHORTCUT, FOCUSED_STATE_SET, RESULT_CANCELED, RESULT_FIRST_USER, RESULT_OK
ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BACKUP_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_NOT_VISIBLE, BIND_VISIBLE, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, COUNTRY_DETECTOR, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, KEYGUARD_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_ROUTER_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_POLICY_SERVICE, NETWORK_STATS_SERVICE, NETWORKMANAGEMENT_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, SCHEDULING_POLICY_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, SERIAL_SERVICE, SIP_SERVICE, STATUS_BAR_SERVICE, STORAGE_SERVICE, TELEPHONY_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, THROTTLE_SERVICE, UI_MODE_SERVICE, UPDATE_LOCK_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN
Constructor and Description |
---|
PreferenceActivity() |
Modifier and Type | Method and Description |
---|---|
void |
addPreferencesFromIntent(Intent intent)
Deprecated.
This function is not relevant for a modern fragment-based
PreferenceActivity.
|
void |
addPreferencesFromResource(int preferencesResId)
Deprecated.
This function is not relevant for a modern fragment-based
PreferenceActivity.
|
Preference |
findPreference(CharSequence key)
Deprecated.
This function is not relevant for a modern fragment-based
PreferenceActivity.
|
void |
finishPreferencePanel(Fragment caller,
int resultCode,
Intent resultData)
Called by a preference panel fragment to finish itself.
|
List<PreferenceActivity.Header> |
getHeaders()
Returns the Header list
|
protected Button |
getNextButton() |
PreferenceManager |
getPreferenceManager()
Deprecated.
This function is not relevant for a modern fragment-based
PreferenceActivity.
|
PreferenceScreen |
getPreferenceScreen()
Deprecated.
This function is not relevant for a modern fragment-based
PreferenceActivity.
|
boolean |
hasHeaders()
Returns true if this activity is currently showing the header list.
|
protected boolean |
hasNextButton() |
void |
invalidateHeaders()
Call when you need to change the headers being displayed.
|
boolean |
isMultiPane()
Returns true if this activity is showing multiple panes -- the headers
and a preference fragment.
|
void |
loadHeadersFromResource(int resid,
List<PreferenceActivity.Header> target)
Parse the given XML file as a header description, adding each
parsed Header into the target list.
|
protected void |
onActivityResult(int requestCode,
int resultCode,
Intent data)
Called when an activity you launched exits, giving you the requestCode
you started it with, the resultCode it returned, and any additional
data from it.
|
void |
onBuildHeaders(List<PreferenceActivity.Header> target)
Called when the activity needs its list of headers build.
|
Intent |
onBuildStartFragmentIntent(String fragmentName,
Bundle args,
int titleRes,
int shortTitleRes)
Called by
startWithFragment(String, Bundle, Fragment, int, int, int) when
in single-pane mode, to build an Intent to launch a new activity showing
the selected fragment. |
void |
onContentChanged()
Updates the screen state (current list and other views) when the
content changes.
|
protected void |
onCreate(Bundle savedInstanceState)
Called when the activity is starting.
|
protected void |
onDestroy()
Perform any final cleanup before an activity is destroyed.
|
PreferenceActivity.Header |
onGetInitialHeader()
Called to determine the initial header to be shown.
|
PreferenceActivity.Header |
onGetNewHeader()
Called after the header list has been updated (
onBuildHeaders(java.util.List<android.preference.PreferenceActivity.Header>)
has been called and returned due to invalidateHeaders() ) to
specify the header that should now be selected. |
void |
onHeaderClick(PreferenceActivity.Header header,
int position)
Called when the user selects an item in the header list.
|
boolean |
onIsHidingHeaders()
Called to determine whether the header list should be hidden.
|
boolean |
onIsMultiPane()
Called to determine if the activity should run in multi-pane mode.
|
protected void |
onListItemClick(ListView l,
View v,
int position,
long id)
This method will be called when an item in the list is selected.
|
protected void |
onNewIntent(Intent intent)
This is called for activities that set launchMode to "singleTop" in
their package, or if a client used the
Intent.FLAG_ACTIVITY_SINGLE_TOP
flag when calling Activity.startActivity(android.content.Intent) . |
boolean |
onPreferenceStartFragment(PreferenceFragment caller,
Preference pref)
Called when the user has clicked on a Preference that has
a fragment class name associated with it.
|
boolean |
onPreferenceTreeClick(PreferenceScreen preferenceScreen,
Preference preference)
Deprecated.
This function is not relevant for a modern fragment-based
PreferenceActivity.
|
protected void |
onRestoreInstanceState(Bundle state)
Ensures the list view has been created before Activity restores all
of the view states.
|
protected void |
onSaveInstanceState(Bundle outState)
Called to retrieve per-instance state from an activity before being killed
so that the state can be restored in
Activity.onCreate(android.os.Bundle) or
Activity.onRestoreInstanceState(android.os.Bundle) (the Bundle populated by this method
will be passed to both). |
protected void |
onStop()
Called when you are no longer visible to the user.
|
void |
setListFooter(View view)
Set a footer that should be shown at the bottom of the header list.
|
void |
setParentTitle(CharSequence title,
CharSequence shortTitle,
View.OnClickListener listener)
Should be called after onCreate to ensure that the breadcrumbs, if any, were created.
|
void |
setPreferenceScreen(PreferenceScreen preferenceScreen)
Deprecated.
This function is not relevant for a modern fragment-based
PreferenceActivity.
|
void |
showBreadCrumbs(CharSequence title,
CharSequence shortTitle)
Change the base title of the bread crumbs for the current preferences.
|
void |
startPreferenceFragment(Fragment fragment,
boolean push)
Start a new fragment.
|
void |
startPreferencePanel(String fragmentClass,
Bundle args,
int titleRes,
CharSequence titleText,
Fragment resultTo,
int resultRequestCode)
Start a new fragment containing a preference panel.
|
void |
startWithFragment(String fragmentName,
Bundle args,
Fragment resultTo,
int resultRequestCode)
Like
startWithFragment(String, Bundle, Fragment, int, int, int)
but uses a 0 titleRes. |
void |
startWithFragment(String fragmentName,
Bundle args,
Fragment resultTo,
int resultRequestCode,
int titleRes,
int shortTitleRes)
Start a new instance of this activity, showing only the given
preference fragment.
|
void |
switchToHeader(PreferenceActivity.Header header)
When in two-pane mode, switch to the fragment pane to show the given
preference fragment.
|
void |
switchToHeader(String fragmentName,
Bundle args)
When in two-pane mode, switch the fragment pane to show the given
preference fragment.
|
getListAdapter, getListView, getSelectedItemId, getSelectedItemPosition, setListAdapter, setSelection
addContentView, closeContextMenu, closeOptionsMenu, createPendingResult, dismissDialog, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, dump, findViewById, finish, finishActivity, finishActivityFromChild, finishAffinity, finishFromChild, getActionBar, getActivityToken, getApplication, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getCurrentFocus, getFragmentManager, getIntent, getLastNonConfigurationInstance, getLayoutInflater, getLoaderManager, getLocalClassName, getMenuInflater, getParent, getParentActivityIntent, getPreferences, getRequestedOrientation, getSystemService, getTaskId, getTitle, getTitleColor, getVolumeControlStream, getWindow, getWindowManager, hasWindowFocus, invalidateOptionsMenu, isChangingConfigurations, isChild, isDestroyed, isFinishing, isImmersive, isResumed, isTaskRoot, managedQuery, managedQuery, moveTaskToBack, navigateUpTo, navigateUpToFromChild, onActionModeFinished, onActionModeStarted, onApplyThemeResource, onAttachedToWindow, onAttachFragment, onBackPressed, onChildTitleChanged, onConfigurationChanged, onContextItemSelected, onContextMenuClosed, onCreateContextMenu, onCreateDescription, onCreateDialog, onCreateDialog, onCreateNavigateUpTaskStack, onCreateOptionsMenu, onCreatePanelMenu, onCreatePanelView, onCreateThumbnail, onCreateView, onCreateView, onDetachedFromWindow, onGenericMotionEvent, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onLowMemory, onMenuItemSelected, onMenuOpened, onNavigateUp, onNavigateUpFromChild, onOptionsItemSelected, onOptionsMenuClosed, onPanelClosed, onPause, onPostCreate, onPostResume, onPrepareDialog, onPrepareDialog, onPrepareNavigateUpTaskStack, onPrepareOptionsMenu, onPreparePanel, onRestart, onResume, onRetainNonConfigurationInstance, onSearchRequested, onStart, onTitleChanged, onTouchEvent, onTrackballEvent, onTrimMemory, onUserInteraction, onUserLeaveHint, onWindowAttributesChanged, onWindowFocusChanged, onWindowStartingActionMode, openContextMenu, openOptionsMenu, overridePendingTransition, recreate, registerForContextMenu, removeDialog, requestWindowFeature, runOnUiThread, setContentView, setContentView, setContentView, setDefaultKeyMode, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setFinishOnTouchOutside, setImmersive, setIntent, setPersistent, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRequestedOrientation, setResult, setResult, setSecondaryProgress, setTitle, setTitle, setTitleColor, setVisible, setVolumeControlStream, shouldUpRecreateTask, showDialog, showDialog, startActionMode, startActivities, startActivities, startActivity, startActivity, startActivityAsUser, startActivityAsUser, startActivityForResult, startActivityForResult, startActivityFromChild, startActivityFromChild, startActivityFromFragment, startActivityFromFragment, startActivityIfNeeded, startActivityIfNeeded, startIntentSender, startIntentSender, startIntentSenderForResult, startIntentSenderForResult, startIntentSenderFromChild, startIntentSenderFromChild, startManagingCursor, startNextMatchingActivity, startNextMatchingActivity, startSearch, stopManagingCursor, takeKeyEvents, triggerSearch, unregisterForContextMenu
applyOverrideConfiguration, attachBaseContext, getResources, getTheme, getThemeResId, setTheme
bindService, bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkUriPermission, checkUriPermission, clearWallpaper, createConfigurationContext, createDisplayContext, createPackageContext, createPackageContextAsUser, databaseList, deleteDatabase, deleteFile, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getCacheDir, getClassLoader, getCompatibilityInfo, getContentResolver, getDatabasePath, getDir, getExternalCacheDir, getExternalFilesDir, getFilesDir, getFileStreamPath, getMainLooper, getObbDir, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getSharedPreferences, getSharedPrefsFile, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isRestricted, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, registerReceiverAsUser, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setWallpaper, setWallpaper, startActivitiesAsUser, startInstrumentation, startService, startServiceAsUser, stopService, stopServiceAsUser, unbindService, unregisterReceiver
getString, getString, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, registerComponentCallbacks, unregisterComponentCallbacks
public static final String EXTRA_SHOW_FRAGMENT
public static final String EXTRA_SHOW_FRAGMENT_ARGUMENTS
EXTRA_SHOW_FRAGMENT
,
this extra can also be specified to supply a Bundle of arguments to pass
to that fragment when it is instantiated during the initial creation
of PreferenceActivity.public static final String EXTRA_SHOW_FRAGMENT_TITLE
EXTRA_SHOW_FRAGMENT
,
this extra can also be specify to supply the title to be shown for
that fragment.public static final String EXTRA_SHOW_FRAGMENT_SHORT_TITLE
EXTRA_SHOW_FRAGMENT
,
this extra can also be specify to supply the short title to be shown for
that fragment.public static final String EXTRA_NO_HEADERS
EXTRA_SHOW_FRAGMENT
to launch
the activity to display a specific fragment that the user has navigated
to.public static final long HEADER_ID_UNDEFINED
Header.id
indicating that no
identifier value is set. All other values (including those below -1)
are valid.protected void onCreate(Bundle savedInstanceState)
Activity
Activity.setContentView(int)
to inflate the
activity's UI, using Activity.findViewById(int)
to programmatically interact
with widgets in the UI, calling
Activity.managedQuery(android.net.Uri , String[], String, String[], String)
to retrieve
cursors for data being displayed, etc.
You can call Activity.finish()
from within this function, in
which case onDestroy() will be immediately called without any of the rest
of the activity lifecycle (Activity.onStart()
, Activity.onResume()
,
Activity.onPause()
, etc) executing.
Derived classes must call through to the super class's implementation of this method. If they do not, an exception will be thrown.
onCreate
in class Activity
savedInstanceState
- If the activity is being re-initialized after
previously being shut down then this Bundle contains the data it most
recently supplied in Activity.onSaveInstanceState(android.os.Bundle)
. Note: Otherwise it is null.Activity.onStart()
,
Activity.onSaveInstanceState(android.os.Bundle)
,
Activity.onRestoreInstanceState(android.os.Bundle)
,
Activity.onPostCreate(android.os.Bundle)
public boolean hasHeaders()
public List<PreferenceActivity.Header> getHeaders()
public boolean isMultiPane()
public boolean onIsMultiPane()
public boolean onIsHidingHeaders()
EXTRA_NO_HEADERS
or false if it is not supplied.
This is set to false, for example, when the activity is being re-launched
to show a particular preference activity.public PreferenceActivity.Header onGetInitialHeader()
public PreferenceActivity.Header onGetNewHeader()
onBuildHeaders(java.util.List<android.preference.PreferenceActivity.Header>)
has been called and returned due to invalidateHeaders()
) to
specify the header that should now be selected. The default implementation
returns null to keep whatever header is currently selected.public void onBuildHeaders(List<PreferenceActivity.Header> target)
Typical implementations will use loadHeadersFromResource(int, java.util.List<android.preference.PreferenceActivity.Header>)
to fill in the list from a resource.
target
- The list in which to place the headers.public void invalidateHeaders()
public void loadHeadersFromResource(int resid, List<PreferenceActivity.Header> target)
resid
- The XML resource to load and parse.target
- The list in which the parsed headers should be placed.public void setListFooter(View view)
protected void onStop()
Activity
Activity.onRestart()
, Activity.onDestroy()
, or nothing,
depending on later user activity.
Note that this method may never be called, in low memory situations
where the system does not have enough memory to keep your activity's
process running after its Activity.onPause()
method is called.
Derived classes must call through to the super class's implementation of this method. If they do not, an exception will be thrown.
onStop
in class Activity
Activity.onRestart()
,
Activity.onResume()
,
Activity.onSaveInstanceState(android.os.Bundle)
,
Activity.onDestroy()
protected void onDestroy()
Activity
Activity.finish()
on it, or because the system is temporarily destroying
this instance of the activity to save space. You can distinguish
between these two scenarios with the Activity.isFinishing()
method.
Note: do not count on this method being called as a place for
saving data! For example, if an activity is editing data in a content
provider, those edits should be committed in either Activity.onPause()
or
Activity.onSaveInstanceState(android.os.Bundle)
, not here. This method is usually implemented to
free resources like threads that are associated with an activity, so
that a destroyed activity does not leave such things around while the
rest of its application is still running. There are situations where
the system will simply kill the activity's hosting process without
calling this method (or any others) in it, so it should not be used to
do things that are intended to remain around after the process goes
away.
Derived classes must call through to the super class's implementation of this method. If they do not, an exception will be thrown.
onDestroy
in class ListActivity
Activity.onDestroy()
protected void onSaveInstanceState(Bundle outState)
Activity
Activity.onCreate(android.os.Bundle)
or
Activity.onRestoreInstanceState(android.os.Bundle)
(the Bundle
populated by this method
will be passed to both).
This method is called before an activity may be killed so that when it
comes back some time in the future it can restore its state. For example,
if activity B is launched in front of activity A, and at some point activity
A is killed to reclaim resources, activity A will have a chance to save the
current state of its user interface via this method so that when the user
returns to activity A, the state of the user interface can be restored
via Activity.onCreate(android.os.Bundle)
or Activity.onRestoreInstanceState(android.os.Bundle)
.
Do not confuse this method with activity lifecycle callbacks such as
Activity.onPause()
, which is always called when an activity is being placed
in the background or on its way to destruction, or Activity.onStop()
which
is called before destruction. One example of when Activity.onPause()
and
Activity.onStop()
is called and not this method is when a user navigates back
from activity B to activity A: there is no need to call Activity.onSaveInstanceState(android.os.Bundle)
on B because that particular instance will never be restored, so the
system avoids calling it. An example when Activity.onPause()
is called and
not Activity.onSaveInstanceState(android.os.Bundle)
is when activity B is launched in front of activity A:
the system may avoid calling Activity.onSaveInstanceState(android.os.Bundle)
on activity A if it isn't
killed during the lifetime of B since the state of the user interface of
A will stay intact.
The default implementation takes care of most of the UI per-instance
state for you by calling View.onSaveInstanceState()
on each
view in the hierarchy that has an id, and by saving the id of the currently
focused view (all of which is restored by the default implementation of
Activity.onRestoreInstanceState(android.os.Bundle)
). If you override this method to save additional
information not captured by each individual view, you will likely want to
call through to the default implementation, otherwise be prepared to save
all of the state of each view yourself.
If called, this method will occur before Activity.onStop()
. There are
no guarantees about whether it will occur before or after Activity.onPause()
.
onSaveInstanceState
in class Activity
outState
- Bundle in which to place your saved state.Activity.onCreate(android.os.Bundle)
,
Activity.onRestoreInstanceState(android.os.Bundle)
,
Activity.onPause()
protected void onRestoreInstanceState(Bundle state)
ListActivity
onRestoreInstanceState
in class ListActivity
state
- the data most recently supplied in Activity.onSaveInstanceState(android.os.Bundle)
.Activity.onRestoreInstanceState(Bundle)
protected void onActivityResult(int requestCode, int resultCode, Intent data)
Activity
Activity.RESULT_CANCELED
if the activity explicitly returned that,
didn't return any result, or crashed during its operation.
You will receive this call immediately before onResume() when your activity is re-starting.
onActivityResult
in class Activity
requestCode
- The integer request code originally supplied to
startActivityForResult(), allowing you to identify who this
result came from.resultCode
- The integer result code returned by the child activity
through its setResult().data
- An Intent, which can return result data to the caller
(various data can be attached to Intent "extras").Activity.startActivityForResult(android.content.Intent, int)
,
Activity.createPendingResult(int, android.content.Intent, int)
,
Activity.setResult(int)
public void onContentChanged()
ListActivity
onContentChanged
in interface Window.Callback
onContentChanged
in class ListActivity
Activity.onContentChanged()
protected void onListItemClick(ListView l, View v, int position, long id)
ListActivity
onListItemClick
in class ListActivity
l
- The ListView where the click happenedv
- The view that was clicked within the ListViewposition
- The position of the view in the listid
- The row id of the item that was clickedpublic void onHeaderClick(PreferenceActivity.Header header, int position)
startWithFragment(String, Bundle, Fragment, int, int, int)
or switchToHeader(Header)
as appropriate.header
- The header that was selected.position
- The header's position in the list.public Intent onBuildStartFragmentIntent(String fragmentName, Bundle args, int titleRes, int shortTitleRes)
startWithFragment(String, Bundle, Fragment, int, int, int)
when
in single-pane mode, to build an Intent to launch a new activity showing
the selected fragment. The default implementation constructs an Intent
that re-launches the current activity with the appropriate arguments to
display the fragment.fragmentName
- The name of the fragment to display.args
- Optional arguments to supply to the fragment.titleRes
- Optional resource ID of title to show for this item.shortTitleRes
- Optional resource ID of short title to show for this item.public void startWithFragment(String fragmentName, Bundle args, Fragment resultTo, int resultRequestCode)
startWithFragment(String, Bundle, Fragment, int, int, int)
but uses a 0 titleRes.public void startWithFragment(String fragmentName, Bundle args, Fragment resultTo, int resultRequestCode, int titleRes, int shortTitleRes)
fragmentName
- The name of the fragment to display.args
- Optional arguments to supply to the fragment.resultTo
- Option fragment that should receive the result of
the activity launch.resultRequestCode
- If resultTo is non-null, this is the request
code in which to report the result.titleRes
- Resource ID of string to display for the title of
this set of preferences.shortTitleRes
- Resource ID of string to display for the short title of
this set of preferences.public void showBreadCrumbs(CharSequence title, CharSequence shortTitle)
FragmentBreadCrumbs
for more information.public void setParentTitle(CharSequence title, CharSequence shortTitle, View.OnClickListener listener)
title
- the title for the breadcrumbshortTitle
- the short title for the breadcrumbpublic void switchToHeader(String fragmentName, Bundle args)
fragmentName
- The name of the fragment to display.args
- Optional arguments to supply to the fragment.public void switchToHeader(PreferenceActivity.Header header)
header
- The new header to display.public void startPreferenceFragment(Fragment fragment, boolean push)
fragment
- The fragment to startpush
- If true, the current fragment will be pushed onto the back stack. If false,
the current fragment will be replaced.public void startPreferencePanel(String fragmentClass, Bundle args, int titleRes, CharSequence titleText, Fragment resultTo, int resultRequestCode)
fragmentClass
- Full name of the class implementing the fragment.args
- Any desired arguments to supply to the fragment.titleRes
- Optional resource identifier of the title of this
fragment.titleText
- Optional text of the title of this fragment.resultTo
- Optional fragment that result data should be sent to.
If non-null, resultTo.onActivityResult() will be called when this
preference panel is done. The launched panel must use
finishPreferencePanel(Fragment, int, Intent)
when done.resultRequestCode
- If resultTo is non-null, this is the caller's
request code to be received with the resut.public void finishPreferencePanel(Fragment caller, int resultCode, Intent resultData)
caller
- The fragment that is asking to be finished.resultCode
- Optional result code to send back to the original
launching fragment.resultData
- Optional result data to send back to the original
launching fragment.public boolean onPreferenceStartFragment(PreferenceFragment caller, Preference pref)
PreferenceFragment.OnPreferenceStartFragmentCallback
onPreferenceStartFragment
in interface PreferenceFragment.OnPreferenceStartFragmentCallback
@Deprecated public PreferenceManager getPreferenceManager()
PreferenceManager
used by this activity.PreferenceManager
.@Deprecated public void setPreferenceScreen(PreferenceScreen preferenceScreen)
preferenceScreen
- The root PreferenceScreen
of the preference hierarchy.@Deprecated public PreferenceScreen getPreferenceScreen()
PreferenceScreen
that is the root of the preference
hierarchy.@Deprecated public void addPreferencesFromIntent(Intent intent)
Intent
.intent
- The Intent
to query activities.@Deprecated public void addPreferencesFromResource(int preferencesResId)
preferencesResId
- The XML resource ID to inflate.@Deprecated public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference)
PreferenceScreen
has been clicked.preferenceScreen
- The PreferenceScreen
that the
preference is located in.preference
- The preference that was clicked.@Deprecated public Preference findPreference(CharSequence key)
Preference
based on its key.key
- The key of the preference to retrieve.Preference
with the key, or null.PreferenceGroup.findPreference(CharSequence)
protected void onNewIntent(Intent intent)
Activity
Intent.FLAG_ACTIVITY_SINGLE_TOP
flag when calling Activity.startActivity(android.content.Intent)
. In either case, when the
activity is re-launched while at the top of the activity stack instead
of a new instance of the activity being started, onNewIntent() will be
called on the existing instance with the Intent that was used to
re-launch it.
An activity will always be paused before receiving a new intent, so
you can count on Activity.onResume()
being called after this method.
Note that Activity.getIntent()
still returns the original Intent. You
can use Activity.setIntent(android.content.Intent)
to update it to this new Intent.
onNewIntent
in class Activity
intent
- The new intent that was started for the activity.Activity.getIntent()
,
Activity.setIntent(android.content.Intent)
,
Activity.onResume()
protected boolean hasNextButton()
protected Button getNextButton()