Android.App.Activity: Method Members

The methods of Android.App.Activity are listed below. For a list of all members, see the Activity Members list.

See Also: Inherited members from Android.Views.ContextThemeWrapper

Public Methods

AddContentView(Android.Views.View, Android.Views.ViewGroup.LayoutParams)
Add an additional content view to the activity.
CloseContextMenu()
Programmatically closes the most recently opened context menu, if showing.
CloseOptionsMenu()
Progammatically closes the options menu.
CreatePendingResult(int, Android.Content.Intent, PendingIntentFlags) : PendingIntent
Create a new PendingIntent object which you can hand to others for them to use to send result data back to your Activity.OnActivityResult(int, Android.App.Result, Android.App.Result) callback.
DismissDialog(int)
Dismiss a dialog that was previously shown via Activity.ShowDialog(int).
DispatchGenericMotionEvent(Android.Views.MotionEvent) : bool
Called to process generic motion events.
DispatchKeyEvent(Android.Views.KeyEvent) : bool
Called to process key events.
DispatchKeyShortcutEvent(Android.Views.KeyEvent) : bool
Called to process a key shortcut event.
DispatchPopulateAccessibilityEvent(Android.Views.Accessibility.AccessibilityEvent) : bool
Called to process population of Android.Views.Accessibility.AccessibilityEvents.
DispatchTouchEvent(Android.Views.MotionEvent) : bool
Called to process touch screen events.
DispatchTrackballEvent(Android.Views.MotionEvent) : bool
Called to process trackball events.
Dump(string, Java.IO.FileDescriptor, Java.IO.PrintWriter, string[])
Print the Activity's state into the given stream.
FindViewById(int) : Android.Views.View
Finds a view that was identified by the id attribute from the XML that was processed in Activity.OnCreate(Android.OS.Bundle).
FindViewById<T>(int) : T
Finds a view that was identified by the id attribute from the XML layout resource.
Finish()
Call this when your activity is done and should be closed.
FinishActivity(int)
Force finish another activity that you had previously started with Activity.StartActivityForResult(Android.Content.Intent, System.Int32).
FinishActivityFromChild(Activity, int)
This is called when a child activity of this one calls its finishActivity().
FinishAffinity()
Finish this activity as well as all activities immediately below it in the current task that have the same affinity.
FinishAfterTransition()
Reverses the Activity Scene entry Transition and triggers the calling Activity to reverse its exit Transition.
FinishAndRemoveTask()
Call this when your activity is done and should be closed and the task should be completely removed as a part of finishing the Activity.
FinishFromChild(Activity)
This is called when a child activity of this one calls its Activity.Finish method.
GetPreferences(Android.Content.FileCreationMode) : Android.Content.ISharedPreferences
Retrieve a Android.Content.ISharedPreferences object for accessing preferences that are private to this activity.
InvalidateOptionsMenu()
Declare that the options menu has changed, so should be recreated.
ManagedQuery(Android.Net.Uri, string[], string, string[], string) : Android.Database.ICursor
Wrapper around Android.Content.ContentResolver.Query(Android.Net.Uri, System.String[], System.String[], System.String[], System.String[]) that gives the resulting Android.Database.ICursor to call Activity.StartManagingCursor(Android.Database.ICursor) so that the activity will manage its lifecycle for you.
MoveTaskToBack(bool) : bool
Move the task containing this activity to the back of the activity stack.
NavigateUpTo(Android.Content.Intent) : bool
Navigate from this activity to the activity specified by upIntent, finishing this activity in the process.
NavigateUpToFromChild(Activity, Android.Content.Intent) : bool
This is called when a child activity of this one calls its Activity.NavigateUpTo(Android.Content.Intent) method.
OnActionModeFinished(Android.Views.ActionMode)
Notifies the activity that an action mode has finished.
OnActionModeStarted(Android.Views.ActionMode)
Notifies the Activity that an action mode has been started.
OnActivityReenter(int, Android.Content.Intent)
Called when an activity you launched with an activity transition exposes this Activity through a returning activity transition, giving you the resultCode and any additional data from it.
OnAttachedToWindow()
Called when the main window associated with the activity has been attached to the window manager.
OnAttachFragment(Fragment)
Called when a Fragment is being attached to this activity, immediately after the call to its Fragment.OnAttach(Activity) method and before Fragment.OnCreate(Android.OS.Bundle).
OnBackPressed()
Called when the activity has detected the user's press of the back key.
OnConfigurationChanged(Android.Content.Res.Configuration)
Called by the system when the device configuration changes while your activity is running.
OnContentChanged()
This hook is called whenever the content view of the screen changes (due to a call to Android.Views.Window.SetContentView(Android.Views.View, .LayoutParams) or Android.Views.Window.AddContentView(Android.Views.View, .LayoutParams)).
OnContextItemSelected(Android.Views.IMenuItem) : bool
This hook is called whenever an item in a context menu is selected.
OnContextMenuClosed(Android.Views.IMenu)
This hook is called whenever the context menu is being closed (either by the user canceling the menu with the back/menu button, or when an item is selected).
OnCreate(Android.OS.Bundle, Android.OS.PersistableBundle)
Same as Activity.OnCreate(Android.OS.Bundle) but called for those activities created with the attribute NoType:android/R$attr;Href=../../../reference/android/R.attr.html#persistableMode set to persistAcrossReboots.
OnCreateContextMenu(Android.Views.IContextMenu, Android.Views.View, Android.Views.IContextMenuContextMenuInfo)
Called when a context menu for the view is about to be shown.
OnCreateDescription() : string
Documentation for this section has not yet been entered.
OnCreateDescriptionFormatted() : Java.Lang.ICharSequence
Generate a new description for this activity.
OnCreateNavigateUpTaskStack(TaskStackBuilder)
Define the synthetic task stack that will be generated during Up navigation from a different task.
OnCreateOptionsMenu(Android.Views.IMenu) : bool
Initialize the contents of the Activity's standard options menu.
OnCreatePanelMenu(int, Android.Views.IMenu) : bool
Default implementation of NoType:android/view/Window$Callback;Href=../../../reference/android/view/Window.Callback.html#onCreatePanelMenu(int, android.view.Menu) for activities.
OnCreatePanelView(int) : Android.Views.View
Default implementation of NoType:android/view/Window$Callback;Href=../../../reference/android/view/Window.Callback.html#onCreatePanelView(int) for activities.
OnCreateThumbnail(Android.Graphics.Bitmap, Android.Graphics.Canvas) : bool
Generate a new thumbnail for this activity.
OnCreateView(string, Android.Content.Context, Android.Util.IAttributeSet) : Android.Views.View
Standard implementation of NoType:android/view/LayoutInflater$Factory;Href=../../../reference/android/view/LayoutInflater.Factory.html#onCreateView(java.lang.String, android.content.Context, android.util.AttributeSet) used when inflating with the LayoutInflater returned by Activity.getSystemService(java.lang.String).
OnCreateView(Android.Views.View, string, Android.Content.Context, Android.Util.IAttributeSet) : Android.Views.View
Standard implementation of NoType:android/view/LayoutInflater$Factory2;Href=../../../reference/android/view/LayoutInflater.Factory2.html#onCreateView(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet) used when inflating with the LayoutInflater returned by Activity.getSystemService(java.lang.String).
OnDetachedFromWindow()
Called when the main window associated with the activity has been detached from the window manager.
OnEnterAnimationComplete()
Activities cannot draw during the period that their windows are animating in.
OnGenericMotionEvent(Android.Views.MotionEvent) : bool
Called when a generic motion event was not handled by any of the views inside of the activity.
OnKeyDown(Android.Views.Keycode, Android.Views.KeyEvent) : bool
Called when a key was pressed down and not handled by any of the views inside of the activity.
OnKeyLongPress(Android.Views.Keycode, Android.Views.KeyEvent) : bool
Default implementation of NoType:android/view/KeyEvent$Callback;Href=../../../reference/android/view/KeyEvent.Callback.html#onKeyLongPress(int, android.view.KeyEvent): always returns false (doesn't handle the event).
OnKeyMultiple(Android.Views.Keycode, int, Android.Views.KeyEvent) : bool
Default implementation of NoType:android/view/KeyEvent$Callback;Href=../../../reference/android/view/KeyEvent.Callback.html#onKeyMultiple(int, int, android.view.KeyEvent): always returns false (doesn't handle the event).
OnKeyShortcut(Android.Views.Keycode, Android.Views.KeyEvent) : bool
Called when a key shortcut event is not handled by any of the views in the Activity.
OnKeyUp(Android.Views.Keycode, Android.Views.KeyEvent) : bool
Called when a key was released and not handled by any of the views inside of the activity.
OnLowMemory()
This is called when the overall system is running low on memory, and actively running processes should trim their memory usage.
OnMenuItemSelected(int, Android.Views.IMenuItem) : bool
Default implementation of NoType:android/view/Window$Callback;Href=../../../reference/android/view/Window.Callback.html#onMenuItemSelected(int, android.view.MenuItem) for activities.
OnMenuOpened(int, Android.Views.IMenu) : bool
Called when a panel's menu is opened by the user.
OnNavigateUp() : bool
This method is called whenever the user chooses to navigate Up within your application's activity hierarchy from the action bar.
OnNavigateUpFromChild(Activity) : bool
This is called when a child activity of this one attempts to navigate up.
OnOptionsItemSelected(Android.Views.IMenuItem) : bool
This hook is called whenever an item in your options menu is selected.
OnOptionsMenuClosed(Android.Views.IMenu)
This hook is called whenever the options menu is being closed (either by the user canceling the menu with the back/menu button, or when an item is selected).
OnPanelClosed(int, Android.Views.IMenu)
Default implementation of NoType:android/view/Window$Callback;Href=../../../reference/android/view/Window.Callback.html#onPanelClosed(int, android.view.Menu) for activities.
OnPostCreate(Android.OS.Bundle, Android.OS.PersistableBundle)
This is the same as Activity.OnPostCreate(Android.OS.Bundle) but is called for activities created with the attribute NoType:android/R$attr;Href=../../../reference/android/R.attr.html#persistableMode set to persistAcrossReboots.
OnPrepareNavigateUpTaskStack(TaskStackBuilder)
Prepare the synthetic task stack that will be generated during Up navigation from a different task.
OnPrepareOptionsMenu(Android.Views.IMenu) : bool
Prepare the Screen's standard options menu to be displayed.
OnPreparePanel(int, Android.Views.View, Android.Views.IMenu) : bool
Default implementation of NoType:android/view/Window$Callback;Href=../../../reference/android/view/Window.Callback.html#onPreparePanel(int, android.view.View, android.view.Menu) for activities.
OnProvideAssistData(Android.OS.Bundle)
This is called when the user is requesting an assist, to build a full Android.Content.Intent.ActionAssist Intent with all of the context of the current application.
OnRestoreInstanceState(Android.OS.Bundle, Android.OS.PersistableBundle)
This is the same as Activity.OnRestoreInstanceState(Android.OS.Bundle) but is called for activities created with the attribute NoType:android/R$attr;Href=../../../reference/android/R.attr.html#persistableMode set to persistAcrossReboots.
OnRetainNonConfigurationInstance() : Java.Lang.Object
Called by the system, as part of destroying an activity due to a configuration change, when it is known that a new instance will immediately be created for the new configuration.
OnSaveInstanceState(Android.OS.Bundle, Android.OS.PersistableBundle)
This is the same as Activity.OnSaveInstanceState(Android.OS.Bundle) but is called for activities created with the attribute NoType:android/R$attr;Href=../../../reference/android/R.attr.html#persistableMode set to persistAcrossReboots.
OnSearchRequested() : bool
This hook is called when the user signals the desire to start a search.
OnTouchEvent(Android.Views.MotionEvent) : bool
Called when a touch screen event was not handled by any of the views under it.
OnTrackballEvent(Android.Views.MotionEvent) : bool
Called when the trackball was moved and not handled by any of the views inside of the activity.
OnTrimMemory(Android.Content.TrimMemory)
Called when the operating system has determined that it is a good time for a process to trim unneeded memory from its process.
OnUserInteraction()
Called whenever a key, touch, or trackball event is dispatched to the activity.
OnVisibleBehindCanceled()
Called when a translucent activity over this activity is becoming opaque or another activity is being launched.
OnWindowAttributesChanged(Android.Views.WindowManagerLayoutParams)
This is called whenever the current window attributes change.
OnWindowFocusChanged(bool)
Called when the current Android.Views.Window of the activity gains or loses focus.
OnWindowStartingActionMode(Android.Views.ActionMode.ICallback) : Android.Views.ActionMode
Give the Activity a chance to control the UI for an action mode requested by the system.
OpenContextMenu(Android.Views.View)
Programmatically opens the context menu for a particular view.
OpenOptionsMenu()
Programmatically opens the options menu.
OverridePendingTransition(int, int)
Call immediately after one of the flavors of Activity.startActivity(android.content.Intent) or Activity.Finish to specify an explicit transition animation to perform next.
PostponeEnterTransition()
Postpone the entering activity transition when Activity was started with ActivityOptions.makeSceneTransitionAnimation(android.app.Activity, android.util.Pair<android.view.View, java.lang.String>...).
Recreate()
Cause this Activity to be recreated with a new instance.
RegisterForContextMenu(Android.Views.View)
Registers a context menu to be shown for the given view (multiple views can show the context menu).
ReleaseInstance() : bool
Ask that the local app instance of this activity be released to free up its memory.
RemoveDialog(int)
Removes any internal references to a dialog managed by this Activity.
ReportFullyDrawn()
Report to the system that your app is now fully drawn, purely for diagnostic purposes (calling it does not impact the visible behavior of the activity).
RequestVisibleBehind(bool) : bool
Activities that want to remain visible behind a translucent activity above them must call this method anytime between the start of Activity.OnResume and the return from Activity.OnPause.
RequestWindowFeature(Android.Views.WindowFeatures) : bool
Enable extended window features.
RunOnUiThread(Java.Lang.IRunnable)
Runs the specified action on the UI thread.
RunOnUiThread(Action)
Documentation for this section has not yet been entered.
SetActionBar(Android.Widget.Toolbar)
Set a Android.Widget.Toolbar to act as the Android.App.ActionBar for this Activity window.
SetContentView(Android.Views.View)
Set the activity content to an explicit view.
SetContentView(int)
Set the activity content from a layout resource.
SetContentView(Android.Views.View, Android.Views.ViewGroup.LayoutParams)
Set the activity content to an explicit view.
SetDefaultKeyMode(DefaultKey)
Select the default key handling for this activity.
SetEnterSharedElementCallback(SharedElementCallback)
When ActivityOptions.MakeSceneTransitionAnimation(Activity, Android.Views.View, Android.Views.View) was used to start an Activity, callback will be called to handle shared elements on the launched Activity.
SetExitSharedElementCallback(SharedElementCallback)
When ActivityOptions.MakeSceneTransitionAnimation(Activity, Android.Views.View, Android.Views.View) was used to start an Activity, callback will be called to handle shared elements on the launching Activity.
SetFeatureDrawable(Android.Views.WindowFeatures, Android.Graphics.Drawables.Drawable)
Convenience for calling Android.Views.Window.SetFeatureDrawable(Android.Views.WindowFeatures, Android.Graphics.Drawables.Drawable).
SetFeatureDrawableAlpha(Android.Views.WindowFeatures, int)
Convenience for calling Android.Views.Window.SetFeatureDrawableAlpha(Android.Views.WindowFeatures, System.Int32).
SetFeatureDrawableResource(Android.Views.WindowFeatures, int)
Convenience for calling Android.Views.Window.SetFeatureDrawableResource(Android.Views.WindowFeatures, System.Int32).
SetFeatureDrawableUri(Android.Views.WindowFeatures, Android.Net.Uri)
Convenience for calling Android.Views.Window.SetFeatureDrawableUri(Android.Views.WindowFeatures, Android.Net.Uri).
SetFinishOnTouchOutside(bool)
Sets whether this activity is finished when touched outside its window's bounds.
SetPersistent(bool)
Documentation for this section has not yet been entered.
SetProgress(int)
Sets the progress for the progress bars in the title.
SetProgressBarIndeterminate(bool)
Sets whether the horizontal progress bar in the title should be indeterminate (the circular is always indeterminate).
SetProgressBarIndeterminateVisibility(bool)
Sets the visibility of the indeterminate progress bar in the title.
SetProgressBarVisibility(bool)
Sets the visibility of the progress bar in the title.
SetResult(Result)
Call this to set the result that your activity will return to its caller.
SetResult(Result, Android.Content.Intent)
Call this to set the result that your activity will return to its caller.
SetSecondaryProgress(int)
Sets the secondary progress for the progress bar in the title.
SetTaskDescription(ActivityManager.TaskDescription)
Sets information describing the task with this activity for presentation inside the Recents System UI.
SetTitle(int)
Change the title associated with this activity.
SetVisible(bool)
Control whether this activity's main window is visible.
ShouldUpRecreateTask(Android.Content.Intent) : bool
Returns true if the app should recreate the task when navigating 'up' from this activity by using targetIntent.
ShowDialog(int)
Simple version of Activity.ShowDialog(int, Android.OS.Bundle) that does not take any arguments.
ShowDialog(int, Android.OS.Bundle) : bool
Show a dialog managed by this activity.
StartActionMode(Android.Views.ActionMode.ICallback) : Android.Views.ActionMode
Start an action mode.
StartActivityForResult(Android.Content.Intent, int)
Same as calling Activity.StartActivityForResult(Android.Content.Intent, System.Int32, System.Int32) with no options.
StartActivityForResult(Type, int)
Documentation for this section has not yet been entered.
StartActivityForResult(Android.Content.Intent, int, Android.OS.Bundle)
Launch an activity for which you would like a result when it finished.
StartActivityFromChild(Activity, Android.Content.Intent, int)
Same as calling Activity.StartActivityFromChild(Activity, Android.Content.Intent, Android.Content.Intent, Android.Content.Intent) with no options.
StartActivityFromChild(Activity, Android.Content.Intent, int, Android.OS.Bundle)
This is called when a child activity of this one calls its Activity.startActivity(android.content.Intent) or Activity.StartActivityForResult(Android.Content.Intent, System.Int32) method.
StartActivityFromFragment(Fragment, Android.Content.Intent, int)
Same as calling Activity.StartActivityFromFragment(Fragment, Android.Content.Intent, Android.Content.Intent, Android.Content.Intent) with no options.
StartActivityFromFragment(Fragment, Android.Content.Intent, int, Android.OS.Bundle)
This is called when a Fragment in this activity calls its Fragment.StartActivity(Android.Content.Intent) or Fragment.StartActivityForResult(Android.Content.Intent, System.Int32) method.
StartActivityIfNeeded(Android.Content.Intent, int) : bool
Same as calling Activity.StartActivityIfNeeded(Android.Content.Intent, System.Int32, System.Int32) with no options.
StartActivityIfNeeded(Android.Content.Intent, int, Android.OS.Bundle) : bool
A special variation to launch an activity only if a new activity instance is needed to handle the given Intent.
StartIntentSenderForResult(Android.Content.IntentSender, int, Android.Content.Intent, Android.Content.ActivityFlags, Android.Content.ActivityFlags, int)
Same as calling Activity.StartIntentSenderForResult(Android.Content.IntentSender, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32) with no options.
StartIntentSenderForResult(Android.Content.IntentSender, int, Android.Content.Intent, Android.Content.ActivityFlags, Android.Content.ActivityFlags, int, Android.OS.Bundle)
Like Activity.StartActivityForResult(Android.Content.Intent, System.Int32), but allowing you to use a IntentSender to describe the activity to be started.
StartIntentSenderFromChild(Activity, Android.Content.IntentSender, int, Android.Content.Intent, Android.Content.ActivityFlags, Android.Content.ActivityFlags, int)
Same as calling Activity.StartIntentSenderFromChild(Activity, Android.Content.IntentSender, Android.Content.IntentSender, Android.Content.IntentSender, Android.Content.IntentSender, Android.Content.IntentSender, Android.Content.IntentSender, Android.Content.IntentSender) with no options.
StartIntentSenderFromChild(Activity, Android.Content.IntentSender, int, Android.Content.Intent, Android.Content.ActivityFlags, Android.Content.ActivityFlags, int, Android.OS.Bundle)
Like Activity.StartActivityFromChild(Activity, Android.Content.Intent, Android.Content.Intent), but taking a IntentSender; see Activity.StartIntentSenderForResult(Android.Content.IntentSender, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32) for more information.
StartLockTask()
Request to put this Activity in a mode where the user is locked to the current task.
StartManagingCursor(Android.Database.ICursor)
This method allows the activity to take care of managing the given Android.Database.ICursor's lifecycle for you based on the activity's lifecycle.
StartNextMatchingActivity(Android.Content.Intent) : bool
Same as calling Activity.StartNextMatchingActivity(Android.Content.Intent, Android.OS.Bundle) with no options.
StartNextMatchingActivity(Android.Content.Intent, Android.OS.Bundle) : bool
Special version of starting an activity, for use when you are replacing other activity components.
StartPostponedEnterTransition()
Begin postponed transitions after Activity.PostponeEnterTransition was called.
StartSearch(string, bool, Android.OS.Bundle, bool)
This hook is called to launch the search UI.
StopLockTask()
Allow the user to switch away from the current task.
StopManagingCursor(Android.Database.ICursor)
Given a Cursor that was previously given to Activity.StartManagingCursor(Android.Database.ICursor), stop the activity's management of that cursor.
TakeKeyEvents(bool)
Request that key events come to this activity.
TriggerSearch(string, Android.OS.Bundle)
Similar to Activity.StartSearch(string, System.Boolean, System.Boolean, System.Boolean), but actually fires off the search query after invoking the search dialog.
UnregisterForContextMenu(Android.Views.View)
Prevents a context menu to be shown for the given view.

Protected Methods

OnActivityResult(int, Result, Android.Content.Intent)
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.
OnChildTitleChanged(Activity, Java.Lang.ICharSequence)
OnChildTitleChanged(Activity, string)
Documentation for this section has not yet been entered.
OnCreate(Android.OS.Bundle)
Called when the activity is starting.
OnCreateDialog(int) : Dialog
OnCreateDialog(int, Android.OS.Bundle) : Dialog
Callback for creating dialogs that are managed (saved and restored) for you by the activity.
OnDestroy()
Perform any final cleanup before an activity is destroyed.
OnNewIntent(Android.Content.Intent)
This is called for activities that set launchMode to "singleTop" in their package, or if a client used the Android.Content.Intent.FLAG_ACTIVITY_SINGLE_TOP flag when calling Activity.startActivity(android.content.Intent).
OnPause()
Called as part of the activity lifecycle when an activity is going into the background, but has not (yet) been killed.
OnPostCreate(Android.OS.Bundle)
Called when activity start-up is complete (after Activity.OnStart and Activity.OnRestoreInstanceState(Android.OS.Bundle) have been called).
OnPostResume()
Called when activity resume is complete (after Activity.OnResume has been called).
OnPrepareDialog(int, Dialog)
OnPrepareDialog(int, Dialog, Android.OS.Bundle)
Provides an opportunity to prepare a managed dialog before it is being shown.
OnRestart()
Called after Activity.OnStop when the current activity is being re-displayed to the user (the user has navigated back to it).
OnRestoreInstanceState(Android.OS.Bundle)
This method is called after Activity.OnStart when the activity is being re-initialized from a previously saved state, given here in savedInstanceState.
OnResume()
Called after Activity.OnRestoreInstanceState(Android.OS.Bundle), Activity.OnRestart, or Activity.OnPause, for your activity to start interacting with the user.
OnSaveInstanceState(Android.OS.Bundle)
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 Android.OS.Bundle populated by this method will be passed to both).
OnStart()
Called after Activity.OnCreate(Android.OS.Bundle) &mdash; or after Activity.OnRestart when the activity had been stopped, but is now again being displayed to the user.
OnStop()
Called when you are no longer visible to the user.
OnTitleChanged(Java.Lang.ICharSequence, Android.Graphics.Color)
OnTitleChanged(string, Android.Graphics.Color)
Documentation for this section has not yet been entered.
OnUserLeaveHint()
Called as part of the activity lifecycle when an activity is about to go into the background as the result of user choice.