|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.content.Context
android.content.ContextWrapper
android.view.ContextThemeWrapper
android.app.Activity
android.support.v4.app.FragmentActivity
public class FragmentActivity

Base class for activities that want to use the support-based
Fragment and
Loader APIs.
When using this class as opposed to new platform's built-in fragment
and loader support, you must use the getSupportFragmentManager()
and getSupportLoaderManager() methods respectively to access
those features.
Known limitations:
When using the <fragment> tag, this implementation can not use the parent view's ID as the new fragment's ID. You must explicitly specify an ID (or tag) in the <fragment>.
Prior to Honeycomb (3.0), an activity's state was saved before pausing. Fragments are a significant amount of new state, and dynamic enough that one often wants them to change between pausing and stopping. These classes throw an exception if you try to change the fragment state after it has been saved, to avoid accidental loss of UI state. However this is too restrictive prior to Honeycomb, where the state is saved before pausing. To address this, when running on platforms prior to Honeycomb an exception will not be thrown if you change fragments between the state save and the activity being stopped. This means that in some cases if the activity is restored from its last saved state, this may be a snapshot slightly before what the user last saw.
| Field Summary |
|---|
| Fields inherited from class android.app.Activity |
|---|
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 |
| Fields inherited from class android.content.Context |
|---|
ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, AUDIO_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_WAIVE_PRIORITY, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, 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, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, STORAGE_SERVICE, TELEPHONY_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, UI_MODE_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WINDOW_SERVICE |
| Fields inherited from interface android.content.ComponentCallbacks2 |
|---|
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 Summary | |
|---|---|
FragmentActivity()
|
|
| Method Summary | |
|---|---|
void |
dump(String prefix,
FileDescriptor fd,
PrintWriter writer,
String[] args)
Print the Activity's state into the given stream. |
Object |
getLastCustomNonConfigurationInstance()
Return the value previously returned from onRetainCustomNonConfigurationInstance(). |
FragmentManager |
getSupportFragmentManager()
Return the FragmentManager for interacting with fragments associated with this activity. |
LoaderManager |
getSupportLoaderManager()
Return the LoaderManager for this fragment, creating it if needed. |
protected void |
onActivityResult(int requestCode,
int resultCode,
android.content.Intent data)
Dispatch incoming result to the correct fragment. |
void |
onAttachFragment(Fragment fragment)
Called when a fragment is attached to the activity. |
void |
onBackPressed()
Take care of popping the fragment back stack or finishing the activity as appropriate. |
void |
onConfigurationChanged(android.content.res.Configuration newConfig)
Dispatch configuration change to all fragments. |
protected void |
onCreate(android.os.Bundle savedInstanceState)
Perform initialization of all fragments and loaders. |
boolean |
onCreatePanelMenu(int featureId,
android.view.Menu menu)
Dispatch to Fragment.onCreateOptionsMenu(). |
android.view.View |
onCreateView(String name,
android.content.Context context,
android.util.AttributeSet attrs)
Add support for inflating the <fragment> tag. |
protected void |
onDestroy()
Destroy all fragments and loaders. |
boolean |
onKeyDown(int keyCode,
android.view.KeyEvent event)
Take care of calling onBackPressed() for pre-Eclair platforms. |
void |
onLowMemory()
Dispatch onLowMemory() to all fragments. |
boolean |
onMenuItemSelected(int featureId,
android.view.MenuItem item)
Dispatch context and options menu to fragments. |
protected void |
onNewIntent(android.content.Intent intent)
Handle onNewIntent() to inform the fragment manager that the state is not saved. |
void |
onPanelClosed(int featureId,
android.view.Menu menu)
Call onOptionsMenuClosed() on fragments. |
protected void |
onPause()
Dispatch onPause() to fragments. |
protected void |
onPostResume()
Dispatch onResume() to fragments. |
boolean |
onPreparePanel(int featureId,
android.view.View view,
android.view.Menu menu)
Dispatch onPrepareOptionsMenu() to fragments. |
protected void |
onResume()
Dispatch onResume() to fragments. |
protected void |
onResumeFragments()
This is the fragment-orientated version of onResume() that you
can override to perform operations in the Activity at the same point
where its fragments are resumed. |
Object |
onRetainCustomNonConfigurationInstance()
Use this instead of onRetainNonConfigurationInstance(). |
Object |
onRetainNonConfigurationInstance()
Retain all appropriate fragment and loader state. |
protected void |
onSaveInstanceState(android.os.Bundle outState)
Save all appropriate fragment state. |
protected void |
onStart()
Dispatch onStart() to all fragments. |
protected void |
onStop()
Dispatch onStop() to all fragments. |
void |
startActivityForResult(android.content.Intent intent,
int requestCode)
Modifies the standard behavior to allow results to be delivered to fragments. |
void |
startActivityFromFragment(Fragment fragment,
android.content.Intent intent,
int requestCode)
Called by Fragment.startActivityForResult() to implement its behavior. |
void |
supportInvalidateOptionsMenu()
Invalidate the activity's options menu. |
| Methods inherited from class android.app.Activity |
|---|
addContentView, closeContextMenu, closeOptionsMenu, createPendingResult, dismissDialog, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, findViewById, finish, finishActivity, finishActivityFromChild, finishAffinity, finishFromChild, getActionBar, 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, isTaskRoot, managedQuery, moveTaskToBack, navigateUpTo, navigateUpToFromChild, onActionModeFinished, onActionModeStarted, onApplyThemeResource, onAttachedToWindow, onAttachFragment, onChildTitleChanged, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreateContextMenu, onCreateDescription, onCreateDialog, onCreateDialog, onCreateNavigateUpTaskStack, onCreateOptionsMenu, onCreatePanelView, onCreateThumbnail, onCreateView, onDetachedFromWindow, onGenericMotionEvent, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onMenuOpened, onNavigateUp, onNavigateUpFromChild, onOptionsItemSelected, onOptionsMenuClosed, onPostCreate, onPrepareDialog, onPrepareDialog, onPrepareNavigateUpTaskStack, onPrepareOptionsMenu, onRestart, onRestoreInstanceState, onSearchRequested, 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, setIntent, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRequestedOrientation, setResult, setResult, setSecondaryProgress, setTitle, setTitle, setTitleColor, setVisible, setVolumeControlStream, shouldUpRecreateTask, showDialog, showDialog, startActionMode, startActivities, startActivities, startActivity, startActivity, startActivityForResult, startActivityFromChild, startActivityFromChild, startActivityFromFragment, startActivityFromFragment, startActivityIfNeeded, startActivityIfNeeded, startIntentSender, startIntentSender, startIntentSenderForResult, startIntentSenderForResult, startIntentSenderFromChild, startIntentSenderFromChild, startManagingCursor, startNextMatchingActivity, startNextMatchingActivity, startSearch, stopManagingCursor, takeKeyEvents, triggerSearch, unregisterForContextMenu |
| Methods inherited from class android.view.ContextThemeWrapper |
|---|
applyOverrideConfiguration, attachBaseContext, getResources, getTheme, setTheme |
| Methods inherited from class android.content.ContextWrapper |
|---|
bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkUriPermission, checkUriPermission, clearWallpaper, createConfigurationContext, createDisplayContext, createPackageContext, databaseList, deleteDatabase, deleteFile, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getCacheDir, getClassLoader, getContentResolver, getDatabasePath, getDir, getExternalCacheDir, getExternalFilesDir, getFilesDir, getFileStreamPath, getMainLooper, getObbDir, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getSharedPreferences, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isRestricted, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setWallpaper, setWallpaper, startInstrumentation, startService, stopService, unbindService, unregisterReceiver |
| Methods inherited from class android.content.Context |
|---|
getString, getString, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, registerComponentCallbacks, unregisterComponentCallbacks |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FragmentActivity()
| Method Detail |
|---|
protected void onActivityResult(int requestCode,
int resultCode,
android.content.Intent data)
onActivityResult in class android.app.Activitypublic void onBackPressed()
onBackPressed in class android.app.Activitypublic void onConfigurationChanged(android.content.res.Configuration newConfig)
onConfigurationChanged in interface android.content.ComponentCallbacksonConfigurationChanged in class android.app.Activityprotected void onCreate(android.os.Bundle savedInstanceState)
onCreate in class android.app.Activity
public boolean onCreatePanelMenu(int featureId,
android.view.Menu menu)
onCreatePanelMenu in interface android.view.Window.CallbackonCreatePanelMenu in class android.app.Activity
public android.view.View onCreateView(String name,
android.content.Context context,
android.util.AttributeSet attrs)
onCreateView in interface android.view.LayoutInflater.FactoryonCreateView in class android.app.Activityprotected void onDestroy()
onDestroy in class android.app.Activity
public boolean onKeyDown(int keyCode,
android.view.KeyEvent event)
onKeyDown in interface android.view.KeyEvent.CallbackonKeyDown in class android.app.Activitypublic void onLowMemory()
onLowMemory in interface android.content.ComponentCallbacksonLowMemory in class android.app.Activity
public boolean onMenuItemSelected(int featureId,
android.view.MenuItem item)
onMenuItemSelected in interface android.view.Window.CallbackonMenuItemSelected in class android.app.Activity
public void onPanelClosed(int featureId,
android.view.Menu menu)
onPanelClosed in interface android.view.Window.CallbackonPanelClosed in class android.app.Activityprotected void onPause()
onPause in class android.app.Activityprotected void onNewIntent(android.content.Intent intent)
onNewIntent in class android.app.Activityprotected void onResume()
onResumeFragments().
onResume in class android.app.Activityprotected void onPostResume()
onPostResume in class android.app.Activityprotected void onResumeFragments()
onResume() that you
can override to perform operations in the Activity at the same point
where its fragments are resumed. Be sure to always call through to
the super-class.
public boolean onPreparePanel(int featureId,
android.view.View view,
android.view.Menu menu)
onPreparePanel in interface android.view.Window.CallbackonPreparePanel in class android.app.Activitypublic final Object onRetainNonConfigurationInstance()
onRetainCustomNonConfigurationInstance()
if you want to retain your own state.
onRetainNonConfigurationInstance in class android.app.Activityprotected void onSaveInstanceState(android.os.Bundle outState)
onSaveInstanceState in class android.app.Activityprotected void onStart()
onStart in class android.app.Activityprotected void onStop()
onStop in class android.app.Activitypublic Object onRetainCustomNonConfigurationInstance()
onRetainNonConfigurationInstance().
Retrieve later with getLastCustomNonConfigurationInstance().
public Object getLastCustomNonConfigurationInstance()
onRetainCustomNonConfigurationInstance().
public void supportInvalidateOptionsMenu()
public void dump(String prefix,
FileDescriptor fd,
PrintWriter writer,
String[] args)
dump in class android.app.Activityprefix - Desired prefix to prepend at each line of output.fd - The raw file descriptor that the dump is being sent to.writer - The PrintWriter to which you should dump your state. This will be
closed for you after you return.args - additional arguments to the dump request.public void onAttachFragment(Fragment fragment)
public FragmentManager getSupportFragmentManager()
public void startActivityForResult(android.content.Intent intent,
int requestCode)
startActivityForResult in class android.app.Activity
public void startActivityFromFragment(Fragment fragment,
android.content.Intent intent,
int requestCode)
public LoaderManager getSupportLoaderManager()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||