Activity Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
An activity is a single, focused thing that the user can do.
[Android.Runtime.Register("android/app/Activity", DoNotGenerateAcw=true)]
public class Activity : Android.Views.ContextThemeWrapper, Android.Content.IComponentCallbacks2, Android.Views.KeyEvent.ICallback, Android.Views.LayoutInflater.IFactory2, Android.Views.View.IOnCreateContextMenuListener, Android.Views.Window.ICallback, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/app/Activity", DoNotGenerateAcw=true)>]
type Activity = class
inherit ContextThemeWrapper
interface IComponentCallbacks
interface IJavaObject
interface IDisposable
interface IJavaPeerable
interface IComponentCallbacks2
interface KeyEvent.ICallback
interface LayoutInflater.IFactory
interface LayoutInflater.IFactory2
interface View.IOnCreateContextMenuListener
interface Window.ICallback
- Inheritance
- Derived
- Attributes
- Implements
Remarks
An activity is a single, focused thing that the user can do. Almost all activities interact with the user, so the Activity class takes care of creating a window for you in which you can place your UI with #setContentView
. While activities are often presented to the user as full-screen windows, they can also be used in other ways: as floating windows (via a theme with android.R.attr#windowIsFloating
set), Multi-Window mode or embedded into other windows.
There are two methods almost all subclasses of Activity will implement:
<ul> <li> #onCreate
is where you initialize your activity. Most importantly, here you will usually call #setContentView(int)
with a layout resource defining your UI, and using #findViewById
to retrieve the widgets in that UI that you need to interact with programmatically.
<li> #onPause
is where you deal with the user pausing active interaction with the activity. Any changes made by the user should at this point be committed (usually to the android.content.ContentProvider
holding the data). In this state the activity is still visible on screen. </ul>
To be of use with android.content.Context#startActivity Context.startActivity()
, all activity classes must have a corresponding android.R.styleable#AndroidManifestActivity <activity>
declaration in their package's AndroidManifest.xml
.
Topics covered here: <ol> <li>Fragments<li>Activity Lifecycle<li>Configuration Changes<li>Starting Activities and Getting Results<li>Saving Persistent State<li>Permissions<li>Process Lifecycle</ol>
<div class="special reference"> <h3>Developer Guides</h3>
The Activity class is an important part of an application's overall lifecycle, and the way activities are launched and put together is a fundamental part of the platform's application model. For a detailed perspective on the structure of an Android application and how activities behave, please read the Application Fundamentals and Tasks and Back Stack developer guides.
You can also find a detailed discussion about how to create activities in the Activities developer guide.
</div>
"Fragments"><h3>Fragments</h3>
The androidx.fragment.app.FragmentActivity
subclass can make use of the androidx.fragment.app.Fragment
class to better modularize their code, build more sophisticated user interfaces for larger screens, and help scale their application between small and large screens.
For more information about using fragments, read the Fragments developer guide.
"ActivityLifecycle"><h3>Activity Lifecycle</h3>
Activities in the system are managed as activity stacks. When a new activity is started, it is usually placed on the top of the current stack and becomes the running activity -- the previous activity always remains below it in the stack, and will not come to the foreground again until the new activity exits. There can be one or multiple activity stacks visible on screen.
An activity has essentially four states:
<ul> <li>If an activity is in the foreground of the screen (at the highest position of the topmost stack), it is <em>active</em> or <em>running</em>. This is usually the activity that the user is currently interacting with.</li> <li>If an activity has lost focus but is still presented to the user, it is <em>visible</em>. It is possible if a new non-full-sized or transparent activity has focus on top of your activity, another activity has higher position in multi-window mode, or the activity itself is not focusable in current windowing mode. Such activity is completely alive (it maintains all state and member information and remains attached to the window manager). <li>If an activity is completely obscured by another activity, it is <em>stopped</em> or <em>hidden</em>. It still retains all state and member information, however, it is no longer visible to the user so its window is hidden and it will often be killed by the system when memory is needed elsewhere.</li> <li>The system can drop the activity from memory by either asking it to finish, or simply killing its process, making it <em>destroyed</em>. When it is displayed again to the user, it must be completely restarted and restored to its previous state.</li> </ul>
The following diagram shows the important state paths of an Activity. The square rectangles represent callback methods you can implement to perform operations when the Activity moves between states. The colored ovals are major states the Activity can be in.
<img src="../../../images/activity_lifecycle.png" alt="State diagram for an Android Activity Lifecycle." border="0" />
There are three key loops you may be interested in monitoring within your activity:
<ul> <li>The <b>entire lifetime</b> of an activity happens between the first call to android.app.Activity#onCreate
through to a single final call to android.app.Activity#onDestroy
. An activity will do all setup of "global" state in onCreate(), and release all remaining resources in onDestroy(). For example, if it has a thread running in the background to download data from the network, it may create that thread in onCreate() and then stop the thread in onDestroy().
<li>The <b>visible lifetime</b> of an activity happens between a call to android.app.Activity#onStart
until a corresponding call to android.app.Activity#onStop
. During this time the user can see the activity on-screen, though it may not be in the foreground and interacting with the user. Between these two methods you can maintain resources that are needed to show the activity to the user. For example, you can register a android.content.BroadcastReceiver
in onStart() to monitor for changes that impact your UI, and unregister it in onStop() when the user no longer sees what you are displaying. The onStart() and onStop() methods can be called multiple times, as the activity becomes visible and hidden to the user.
<li>The <b>foreground lifetime</b> of an activity happens between a call to android.app.Activity#onResume
until a corresponding call to android.app.Activity#onPause
. During this time the activity is visible, active and interacting with the user. An activity can frequently go between the resumed and paused states -- for example when the device goes to sleep, when an activity result is delivered, when a new intent is delivered -- so the code in these methods should be fairly lightweight. </ul>
The entire lifecycle of an activity is defined by the following Activity methods. All of these are hooks that you can override to do appropriate work when the activity changes state. All activities will implement android.app.Activity#onCreate
to do their initial setup; many will also implement android.app.Activity#onPause
to commit changes to data and prepare to pause interacting with the user, and android.app.Activity#onStop
to handle no longer being visible on screen. You should always call up to your superclass when implementing these methods.
</p>
public class Activity extends ApplicationContext {
protected void onCreate(Bundle savedInstanceState);
protected void onStart();
protected void onRestart();
protected void onResume();
protected void onPause();
protected void onStop();
protected void onDestroy();
}
In general the movement through an activity's lifecycle looks like this:
<table border="2" width="85%" align="center" frame="hsides" rules="rows"> <colgroup align="left" span="3" /> <colgroup align="left" /> <colgroup align="center" /> <colgroup align="center" />
<thead> <tr><th colspan="3">Method</th> <th>Description</th> <th>Killable?</th> <th>Next</th></tr> </thead>
<tbody> <tr><td colspan="3" align="left" border="0">android.app.Activity#onCreate onCreate()
</td> <td>Called when the activity is first created. This is where you should do all of your normal static set up: create views, bind data to lists, etc. This method also provides you with a Bundle containing the activity's previously frozen state, if there was one.
Always followed by onStart()
.</td> <td align="center">No</td> <td align="center">onStart()
</td> </tr>
<tr><td rowspan="5" style="border-left: none; border-right: none;"> </td> <td colspan="2" align="left" border="0">android.app.Activity#onRestart onRestart()
</td> <td>Called after your activity has been stopped, prior to it being started again.
Always followed by onStart()
</td> <td align="center">No</td> <td align="center">onStart()
</td> </tr>
<tr><td colspan="2" align="left" border="0">android.app.Activity#onStart onStart()
</td> <td>Called when the activity is becoming visible to the user.
Followed by onResume()
if the activity comes to the foreground, or onStop()
if it becomes hidden.</td> <td align="center">No</td> <td align="center">onResume()
or onStop()
</td> </tr>
<tr><td rowspan="2" style="border-left: none;"> </td> <td align="left" border="0">android.app.Activity#onResume onResume()
</td> <td>Called when the activity will start interacting with the user. At this point your activity is at the top of its activity stack, with user input going to it.
Always followed by onPause()
.</td> <td align="center">No</td> <td align="center">onPause()
</td> </tr>
<tr><td align="left" border="0">android.app.Activity#onPause onPause()
</td> <td>Called when the activity loses foreground state, is no longer focusable or before transition to stopped/hidden or destroyed state. The activity is still visible to user, so it's recommended to keep it visually active and continue updating the UI. Implementations of this method must be very quick because the next activity will not be resumed until this method returns.
Followed by either onResume()
if the activity returns back to the front, or onStop()
if it becomes invisible to the user.</td> <td align="center"><font color="#800000"><strong>Pre-android.os.Build.VERSION_CODES#HONEYCOMB
</strong></font></td> <td align="center">onResume()
or<br> onStop()
</td> </tr>
<tr><td colspan="2" align="left" border="0">android.app.Activity#onStop onStop()
</td> <td>Called when the activity is no longer visible to the user. This may happen either because a new activity is being started on top, an existing one is being brought in front of this one, or this one is being destroyed. This is typically used to stop animations and refreshing the UI, etc.
Followed by either onRestart()
if this activity is coming back to interact with the user, or onDestroy()
if this activity is going away.</td> <td align="center"><font color="#800000"><strong>Yes</strong></font></td> <td align="center">onRestart()
or<br> onDestroy()
</td> </tr>
<tr><td colspan="3" align="left" border="0">android.app.Activity#onDestroy onDestroy()
</td> <td>The final call you receive before your activity is destroyed. This can happen either because the activity is finishing (someone called 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.</td> <td align="center"><font color="#800000"><strong>Yes</strong></font></td> <td align="center"><em>nothing</em></td> </tr> </tbody> </table>
Note the "Killable" column in the above table -- for those methods that are marked as being killable, after that method returns the process hosting the activity may be killed by the system <em>at any time</em> without another line of its code being executed. Because of this, you should use the #onPause
method to write any persistent data (such as user edits) to storage. In addition, the method #onSaveInstanceState(Bundle)
is called before placing the activity in such a background state, allowing you to save away any dynamic instance state in your activity into the given Bundle, to be later received in #onCreate
if the activity needs to be re-created. See the Process Lifecycle section for more information on how the lifecycle of a process is tied to the activities it is hosting. Note that it is important to save persistent data in #onPause
instead of #onSaveInstanceState
because the latter is not part of the lifecycle callbacks, so will not be called in every situation as described in its documentation.
<p class="note">Be aware that these semantics will change slightly between applications targeting platforms starting with android.os.Build.VERSION_CODES#HONEYCOMB
vs. those targeting prior platforms. Starting with Honeycomb, an application is not in the killable state until its #onStop
has returned. This impacts when #onSaveInstanceState(Bundle)
may be called (it may be safely called after #onPause()
) and allows an application to safely wait until #onStop()
to save persistent state.</p>
<p class="note">For applications targeting platforms starting with android.os.Build.VERSION_CODES#P
#onSaveInstanceState(Bundle)
will always be called after #onStop
, so an application may safely perform fragment transactions in #onStop
and will be able to save persistent state later.</p>
For those methods that are not marked as being killable, the activity's process will not be killed by the system starting from the time the method is called and continuing after it returns. Thus an activity is in the killable state, for example, between after onStop()
to the start of onResume()
. Keep in mind that under extreme memory pressure the system can kill the application process at any time.
"ConfigurationChanges"><h3>Configuration Changes</h3>
If the configuration of the device (as defined by the Configuration Resources.Configuration
class) changes, then anything displaying a user interface will need to update to match that configuration. Because Activity is the primary mechanism for interacting with the user, it includes special support for handling configuration changes.
Unless you specify otherwise, a configuration change (such as a change in screen orientation, language, input devices, etc) will cause your current activity to be <em>destroyed</em>, going through the normal activity lifecycle process of #onPause
, #onStop
, and #onDestroy
as appropriate. If the activity had been in the foreground or visible to the user, once #onDestroy
is called in that instance then a new instance of the activity will be created, with whatever savedInstanceState the previous instance had generated from #onSaveInstanceState
.
This is done because any application resource, including layout files, can change based on any configuration value. Thus the only safe way to handle a configuration change is to re-retrieve all resources, including layouts, drawables, and strings. Because activities must already know how to save their state and re-create themselves from that state, this is a convenient way to have an activity restart itself with a new configuration.
In some special cases, you may want to bypass restarting of your activity based on one or more types of configuration changes. This is done with the android.R.attr#configChanges android:configChanges
attribute in its manifest. For any types of configuration changes you say that you handle there, you will receive a call to your current activity's #onConfigurationChanged
method instead of being restarted. If a configuration change involves any that you do not handle, however, the activity will still be restarted and #onConfigurationChanged
will not be called.
"StartingActivities"><h3>Starting Activities and Getting Results</h3>
The android.app.Activity#startActivity
method is used to start a new activity, which will be placed at the top of the activity stack. It takes a single argument, an android.content.Intent Intent
, which describes the activity to be executed.
Sometimes you want to get a result back from an activity when it ends. For example, you may start an activity that lets the user pick a person in a list of contacts; when it ends, it returns the person that was selected. To do this, you call the android.app.Activity#startActivityForResult(Intent, int)
version with a second integer parameter identifying the call. The result will come back through your android.app.Activity#onActivityResult
method.
When an activity exits, it can call android.app.Activity#setResult(int)
to return data back to its parent. It must always supply a result code, which can be the standard results RESULT_CANCELED, RESULT_OK, or any custom values starting at RESULT_FIRST_USER. In addition, it can optionally return back an Intent containing any additional data it wants. All of this information appears back on the parent's Activity.onActivityResult()
, along with the integer identifier it originally supplied.
If a child activity fails for any reason (such as crashing), the parent activity will receive a result with the code RESULT_CANCELED.
public class MyActivity extends Activity {
...
static final int PICK_CONTACT_REQUEST = 0;
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
// When the user center presses, let them pick a contact.
startActivityForResult(
new Intent(Intent.ACTION_PICK,
new Uri("content://contacts")),
PICK_CONTACT_REQUEST);
return true;
}
return false;
}
protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
if (requestCode == PICK_CONTACT_REQUEST) {
if (resultCode == RESULT_OK) {
// A contact was picked. Here we will just display it
// to the user.
startActivity(new Intent(Intent.ACTION_VIEW, data));
}
}
}
}
"SavingPersistentState"><h3>Saving Persistent State</h3>
There are generally two kinds of persistent state that an activity will deal with: shared document-like data (typically stored in a SQLite database using a android.content.ContentProvider content provider) and internal state such as user preferences.
For content provider data, we suggest that activities use an "edit in place" user model. That is, any edits a user makes are effectively made immediately without requiring an additional confirmation step. Supporting this model is generally a simple matter of following two rules:
<ul> <li>
When creating a new document, the backing database entry or file for it is created immediately. For example, if the user chooses to write a new email, a new entry for that email is created as soon as they start entering data, so that if they go to any other activity after that point this email will now appear in the list of drafts.
<li>
When an activity's onPause()
method is called, it should commit to the backing content provider or file any changes the user has made. This ensures that those changes will be seen by any other activity that is about to run. You will probably want to commit your data even more aggressively at key times during your activity's lifecycle: for example before starting a new activity, before finishing your own activity, when the user switches between input fields, etc.
</ul>
This model is designed to prevent data loss when a user is navigating between activities, and allows the system to safely kill an activity (because system resources are needed somewhere else) at any time after it has been stopped (or paused on platform versions before android.os.Build.VERSION_CODES#HONEYCOMB
). Note this implies that the user pressing BACK from your activity does <em>not</em> mean "cancel" -- it means to leave the activity with its current contents saved away. Canceling edits in an activity must be provided through some other mechanism, such as an explicit "revert" or "undo" option.
See the android.content.ContentProvider content package for more information about content providers. These are a key aspect of how different activities invoke and propagate data between themselves.
The Activity class also provides an API for managing internal persistent state associated with an activity. This can be used, for example, to remember the user's preferred initial display in a calendar (day view or week view) or the user's default home page in a web browser.
Activity persistent state is managed with the method #getPreferences
, allowing you to retrieve and modify a set of name/value pairs associated with the activity. To use preferences that are shared across multiple application components (activities, receivers, services, providers), you can use the underlying Context#getSharedPreferences Context.getSharedPreferences()
method to retrieve a preferences object stored under a specific name. (Note that it is not possible to share settings data across application packages -- for that you will need a content provider.)
Here is an excerpt from a calendar activity that stores the user's preferred view mode in its persistent settings:
public class CalendarActivity extends Activity {
...
static final int DAY_VIEW_MODE = 0;
static final int WEEK_VIEW_MODE = 1;
private SharedPreferences mPrefs;
private int mCurViewMode;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mPrefs = getSharedPreferences(getLocalClassName(), MODE_PRIVATE);
mCurViewMode = mPrefs.getInt("view_mode", DAY_VIEW_MODE);
}
protected void onPause() {
super.onPause();
SharedPreferences.Editor ed = mPrefs.edit();
ed.putInt("view_mode", mCurViewMode);
ed.commit();
}
}
"Permissions"><h3>Permissions</h3>
The ability to start a particular Activity can be enforced when it is declared in its manifest's android.R.styleable#AndroidManifestActivity <activity>
tag. By doing so, other applications will need to declare a corresponding android.R.styleable#AndroidManifestUsesPermission <uses-permission>
element in their own manifest to be able to start that activity.
When starting an Activity you can set Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION
and/or Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION
on the Intent. This will grant the Activity access to the specific URIs in the Intent. Access will remain until the Activity has finished (it will remain across the hosting process being killed and other temporary destruction). As of android.os.Build.VERSION_CODES#GINGERBREAD
, if the Activity was already created and a new Intent is being delivered to #onNewIntent(Intent)
, any newly granted URI permissions will be added to the existing ones it holds.
See the Security and Permissions document for more information on permissions and security in general.
"ProcessLifecycle"><h3>Process Lifecycle</h3>
The Android system attempts to keep an application process around for as long as possible, but eventually will need to remove old processes when memory runs low. As described in Activity Lifecycle, the decision about which process to remove is intimately tied to the state of the user's interaction with it. In general, there are four states a process can be in based on the activities running in it, listed here in order of importance. The system will kill less important processes (the last ones) before it resorts to killing more important processes (the first ones).
<ol> <li>
The <b>foreground activity</b> (the activity at the top of the screen that the user is currently interacting with) is considered the most important. Its process will only be killed as a last resort, if it uses more memory than is available on the device. Generally at this point the device has reached a memory paging state, so this is required in order to keep the user interface responsive. <li>
A <b>visible activity</b> (an activity that is visible to the user but not in the foreground, such as one sitting behind a foreground dialog or next to other activities in multi-window mode) is considered extremely important and will not be killed unless that is required to keep the foreground activity running. <li>
A <b>background activity</b> (an activity that is not visible to the user and has been stopped) is no longer critical, so the system may safely kill its process to reclaim memory for other foreground or visible processes. If its process needs to be killed, when the user navigates back to the activity (making it visible on the screen again), its #onCreate
method will be called with the savedInstanceState it had previously supplied in #onSaveInstanceState
so that it can restart itself in the same state as the user last left it. <li>
An <b>empty process</b> is one hosting no activities or other application components (such as Service
or android.content.BroadcastReceiver
classes). These are killed very quickly by the system as memory becomes low. For this reason, any background operation you do outside of an activity must be executed in the context of an activity BroadcastReceiver or Service to ensure that the system knows it needs to keep your process around. </ol>
Sometimes an Activity may need to do a long-running operation that exists independently of the activity lifecycle itself. An example may be a camera application that allows you to upload a picture to a web site. The upload may take a long time, and the application should allow the user to leave the application while it is executing. To accomplish this, your Activity should start a Service
in which the upload takes place. This allows the system to properly prioritize your process (considering it to be more important than other non-visible applications) for the duration of the upload, independent of whether the original activity is paused, stopped, or finished.
Java documentation for android.app.Activity
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Constructors
Activity() | |
Activity(IntPtr, JniHandleOwnership) |
A constructor used when creating managed representations of JNI objects; called by the runtime. |
Fields
AccessibilityService |
Use with |
AccountService |
Use with |
ActivityService |
Use with |
AlarmService |
Use with |
AppOpsService |
Use with |
AppSearchService |
Use with |
AppwidgetService |
Use with |
AudioService |
Use with |
BatteryService |
Use with |
BindAllowActivityStarts |
Obsolete.
Flag for |
BindExternalServiceLong |
Works in the same way as |
BindNotPerceptible |
Obsolete.
Flag for |
BindSharedIsolatedProcess |
Obsolete.
Flag for |
BiometricService |
Use with |
BlobStoreService |
Use with |
BluetoothService |
Use with |
BugreportService |
Service to capture a bugreport. (Inherited from Context) |
CameraService |
Use with |
CaptioningService |
Use with |
CarrierConfigService |
Use with |
ClipboardService |
Use with |
CompanionDeviceService |
Use with |
ConnectivityDiagnosticsService |
Use with |
ConnectivityService |
Use with |
ConsumerIrService |
Use with |
CredentialService |
Use with |
CrossProfileAppsService |
Use with |
DeviceIdDefault |
The default device ID, which is the ID of the primary (non-virtual) device. (Inherited from Context) |
DeviceIdInvalid |
Invalid device ID. (Inherited from Context) |
DeviceLockService |
Use with |
DevicePolicyService |
Use with |
DisplayHashService |
Use with |
DisplayService |
Use with |
DomainVerificationService |
Use with |
DownloadService |
Use with |
DropboxService |
Use with |
EuiccService |
Use with |
FileIntegrityService |
Use with |
FingerprintService |
Use with |
FullscreenModeRequestEnter |
Obsolete.
Request type of |
FullscreenModeRequestExit |
Obsolete.
Request type of |
GameService |
Use with |
GrammaticalInflectionService |
Use with |
HardwarePropertiesService |
Use with |
HealthconnectService |
Use with |
InputMethodService |
Use with |
InputService |
Use with |
IpsecService |
Use with |
JobSchedulerService |
Use with |
KeyguardService |
Use with |
LauncherAppsService |
Use with |
LayoutInflaterService |
Use with |
LocaleService |
Use with |
LocationService |
Use with |
MediaCommunicationService |
Use with |
MediaMetricsService |
Use with |
MediaProjectionService |
Use with |
MediaRouterService |
Use with |
MediaSessionService |
Use with |
MidiService |
Use with |
NetworkStatsService |
Use with |
NfcService |
Use with |
NotificationService |
Use with |
NsdService |
Use with |
OverlayService |
Use with |
OverrideTransitionClose |
Obsolete.
Request type of |
OverrideTransitionOpen |
Obsolete.
Request type of |
PeopleService |
Use with |
PerformanceHintService |
Use with |
PowerService |
Use with |
PrintService |
|
ReceiverExported |
Obsolete.
Flag for |
ReceiverNotExported |
Obsolete.
Flag for |
ReceiverVisibleToInstantApps |
Obsolete.
Flag for |
RestrictionsService |
Use with |
RoleService |
Use with |
SearchService |
Use with |
SensorService |
Use with |
ShortcutService |
Use with |
StatusBarService |
Use with |
StorageService |
Use with |
StorageStatsService |
Use with |
SystemHealthService |
Use with |
TelecomService |
Use with |
TelephonyImsService |
Use with |
TelephonyService |
Use with |
TelephonySubscriptionService |
Use with |
TextClassificationService |
Use with |
TextServicesManagerService |
Use with |
TvInputService |
Use with |
TvInteractiveAppService |
Use with |
UiModeService |
Use with |
UsageStatsService |
Use with |
UsbService |
Use with |
UserService |
Use with |
VibratorManagerService |
Use with |
VibratorService |
Use with |
VirtualDeviceService |
Use with |
VpnManagementService |
Use with |
WallpaperService |
Use with |
WifiAwareService |
Use with |
WifiP2pService |
Use with |
WifiRttRangingService |
Use with |
WifiService |
Use with |
WindowService |
Use with |
Properties
ActionBar |
Retrieve a reference to this activity's ActionBar. |
Application |
Return the application that owns this activity. |
ApplicationContext |
Return the context of the single, global Application object of the current process. (Inherited from ContextWrapper) |
ApplicationInfo |
Return the full application info for this context's package. (Inherited from ContextWrapper) |
Assets |
Return an AssetManager instance for your application's package. (Inherited from ContextWrapper) |
AttributionSource | (Inherited from Context) |
AttributionTag |
Attribution can be used in complex apps to logically separate parts of the app. (Inherited from Context) |
BaseContext | (Inherited from ContextWrapper) |
CacheDir |
Returns the absolute path to the application specific cache directory on the filesystem. (Inherited from ContextWrapper) |
CallingActivity |
Return the name of the activity that invoked this activity. |
CallingPackage |
Return the name of the package that invoked this activity. |
ChangingConfigurations |
If this activity is being destroyed because it can not handle a
configuration parameter being changed (and thus its
|
Class |
Returns the runtime class of this |
ClassLoader |
Return a class loader you can use to retrieve classes in this package. (Inherited from ContextWrapper) |
CodeCacheDir |
Returns the absolute path to the application specific cache directory on the filesystem designed for storing cached code. (Inherited from ContextWrapper) |
ComponentName |
Returns the complete component name of this activity. |
ContentResolver |
Return a ContentResolver instance for your application's package. (Inherited from ContextWrapper) |
ContentScene |
Retrieve the |
ContentTransitionManager |
Retrieve the |
CurrentFocus |
Calls |
DataDir | (Inherited from ContextWrapper) |
DeviceId |
Gets the device ID this context is associated with. (Inherited from Context) |
Display |
Get the display this context is associated with. (Inherited from Context) |
ExternalCacheDir |
Returns the absolute path to the directory on the primary external filesystem (that is somewhere on ExternalStorageDirectory where the application can place cache files it owns. (Inherited from ContextWrapper) |
FilesDir |
Returns the absolute path to the directory on the filesystem where files created with OpenFileOutput(String, FileCreationMode) are stored. (Inherited from ContextWrapper) |
FocusedStateSet | |
FragmentManager |
Return the FragmentManager for interacting with fragments associated with this activity. |
Handle |
The handle to the underlying Android instance. (Inherited from Object) |
HasWindowFocus |
Returns true if this activity's <em>main</em> window currently has window focus. |
Immersive |
Bit indicating that this activity is "immersive" and should not be interrupted by notifications if possible. -or- Adjust the current immersive mode setting. |
InstanceCount | |
Intent |
Return the intent that started this activity. -or- Change the intent returned by |
IsActivityTransitionRunning |
Returns whether there are any activity transitions currently running on this activity. |
IsChangingConfigurations |
Check to see whether this activity is in the process of being destroyed in order to be recreated with a new configuration. |
IsChild |
Is this activity embedded inside of another activity? |
IsDestroyed |
Returns true if the final |
IsDeviceProtectedStorage | (Inherited from ContextWrapper) |
IsFinishing |
Check to see whether this activity is in the process of finishing,
either because you called |
IsInMultiWindowMode |
Returns true if the activity is currently in multi-window mode. |
IsInPictureInPictureMode |
Returns true if the activity is currently in picture-in-picture mode. |
IsLaunchedFromBubble |
Indicates whether this activity is launched from a bubble. |
IsLocalVoiceInteractionSupported |
Queries whether the currently enabled voice interaction service supports returning a voice interactor for use by the activity. |
IsRestricted |
Indicates whether this Context is restricted. (Inherited from Context) |
IsTaskRoot |
Return whether this activity is the root of a task. |
IsUiContext |
Returns |
IsVoiceInteraction |
Check whether this activity is running as part of a voice interaction with the user. |
IsVoiceInteractionRoot |
Like |
JniIdentityHashCode | (Inherited from Object) |
JniPeerMembers | |
LastNonConfigurationInstance |
Retrieve the non-configuration instance data that was previously
returned by |
LaunchedFromPackage |
Returns the package name of the app that initially launched this activity. |
LaunchedFromUid |
Returns the uid of the app that initially launched this activity. |
LayoutInflater |
Convenience for calling
|
LoaderManager |
Return the LoaderManager for this activity, creating it if needed. |
LocalClassName |
Returns class name for this activity with the package prefix removed. |
MainExecutor |
Return an |
MainLooper |
Return the Looper for the main thread of the current process. (Inherited from ContextWrapper) |
MaxNumPictureInPictureActions |
Return the number of actions that will be displayed in the picture-in-picture UI when the user interacts with the activity currently in picture-in-picture mode. |
MediaController |
Gets the controller which should be receiving media key and volume events
while this activity is in the foreground. -or- Sets a |
MenuInflater |
Returns a |
NoBackupFilesDir |
Returns the absolute path to the directory on the filesystem similar to FilesDir. (Inherited from ContextWrapper) |
ObbDir |
Return the primary external storage directory where this application's OBB files (if there are any) can be found. (Inherited from ContextWrapper) |
OnBackInvokedDispatcher |
Returns the |
OpPackageName |
Return the package name that should be used for |
PackageCodePath |
Return the full path to this context's primary Android package. (Inherited from ContextWrapper) |
PackageManager |
Return PackageManager instance to find global package information. (Inherited from ContextWrapper) |
PackageName |
Return the name of this application's package. (Inherited from ContextWrapper) |
PackageResourcePath |
Return the full path to this context's primary Android package. (Inherited from ContextWrapper) |
Params |
Return the set of parameters which this Context was created with, if it
was created via |
Parent |
Return the parent activity if this view is an embedded child. |
ParentActivityIntent |
Obtain an |
PeerReference | (Inherited from Object) |
Referrer |
Return information about who launched this activity. |
RequestedOrientation |
Return the current requested orientation of the activity. -or- Change the desired orientation of this activity. |
Resources |
Return a Resources instance for your application's package. (Inherited from ContextWrapper) |
SearchEvent |
During the onSearchRequested() callbacks, this function will return the
|
SplashScreen |
Get the interface that activity use to talk to the splash screen. |
TaskId |
Return the identifier of the task this activity is in. |
Theme |
Return the Theme object associated with this Context. (Inherited from ContextWrapper) |
ThresholdClass |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. |
ThresholdType |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. |
Title | |
TitleColor |
Obsolete.
Change the color of the title associated with this activity. |
TitleFormatted |
Change the title associated with this activity. |
VoiceInteractor |
Retrieve the active |
VolumeControlStream |
Gets the suggested audio stream whose volume should be changed by the hardware volume controls. -or- Suggests an audio stream whose volume should be changed by the hardware volume controls. |
Wallpaper | (Inherited from ContextWrapper) |
WallpaperDesiredMinimumHeight | (Inherited from ContextWrapper) |
WallpaperDesiredMinimumWidth | (Inherited from ContextWrapper) |
Window |
Retrieve the current |
WindowManager |
Retrieve the window manager for showing custom windows. |
Methods
AddContentView(View, ViewGroup+LayoutParams) |
Add an additional content view to the activity. |
ApplyOverrideConfiguration(Configuration) |
Call to set an "override configuration" on this context -- this is a configuration that replies one or more values of the standard configuration that is applied to the context. (Inherited from ContextThemeWrapper) |
AttachBaseContext(Context) |
Set the base context for this ContextWrapper. (Inherited from ContextWrapper) |
BindService(Intent, Bind, IExecutor, IServiceConnection) |
Same as |
BindService(Intent, Context+BindServiceFlags, IExecutor, IServiceConnection) | (Inherited from Context) |
BindService(Intent, IServiceConnection, Bind) |
Connect to an application service, creating it if needed. (Inherited from ContextWrapper) |
BindService(Intent, IServiceConnection, Context+BindServiceFlags) | (Inherited from Context) |
BindServiceAsUser(Intent, IServiceConnection, Context+BindServiceFlags, UserHandle) | (Inherited from Context) |
BindServiceAsUser(Intent, IServiceConnection, Int32, UserHandle) |
Binds to a service in the given |
CheckCallingOrSelfPermission(String) |
Determine whether the calling process of an IPC or you have been granted a particular permission. (Inherited from ContextWrapper) |
CheckCallingOrSelfUriPermission(Uri, ActivityFlags) |
Determine whether the calling process of an IPC or you has been granted permission to access a specific URI. (Inherited from ContextWrapper) |
CheckCallingOrSelfUriPermissions(IList<Uri>, Int32) |
Determine whether the calling process of an IPC <em>or you</em> has been granted permission to access a list of URIs. (Inherited from Context) |
CheckCallingPermission(String) |
Determine whether the calling process of an IPC you are handling has been granted a particular permission. (Inherited from ContextWrapper) |
CheckCallingUriPermission(Uri, ActivityFlags) |
Determine whether the calling process and user ID has been granted permission to access a specific URI. (Inherited from ContextWrapper) |
CheckCallingUriPermissions(IList<Uri>, Int32) |
Determine whether the calling process and user ID has been granted permission to access a list of URIs. (Inherited from Context) |
CheckPermission(String, Int32, Int32) |
Determine whether the given permission is allowed for a particular process and user ID running in the system. (Inherited from ContextWrapper) |
CheckSelfPermission(String) | (Inherited from ContextWrapper) |
CheckUriPermission(Uri, Int32, Int32, ActivityFlags) |
Determine whether a particular process and user ID has been granted permission to access a specific URI. (Inherited from ContextWrapper) |
CheckUriPermission(Uri, String, String, Int32, Int32, ActivityFlags) |
Check both a Uri and normal permission. (Inherited from ContextWrapper) |
CheckUriPermissions(IList<Uri>, Int32, Int32, Int32) |
Determine whether a particular process and user ID has been granted permission to access a list of URIs. (Inherited from Context) |
ClearOverrideActivityTransition(OverrideTransition) |
Clears the animations which are set from |
ClearWallpaper() |
Obsolete.
(Inherited from ContextWrapper)
|
Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
CloseContextMenu() |
Programmatically closes the most recently opened context menu, if showing. |
CloseOptionsMenu() |
Progammatically closes the options menu. |
CreateAttributionContext(String) |
Return a new Context object for the current Context but attribute to a different tag. (Inherited from Context) |
CreateConfigurationContext(Configuration) |
Return a new Context object for the current Context but whose resources are adjusted to match the given Configuration. (Inherited from ContextWrapper) |
CreateContext(ContextParams) |
Creates a context with specific properties and behaviors. (Inherited from Context) |
CreateContextForSplit(String) | (Inherited from ContextWrapper) |
CreateDeviceContext(Int32) |
Returns a new |
CreateDeviceProtectedStorageContext() | (Inherited from ContextWrapper) |
CreateDisplayContext(Display) |
Return a new Context object for the current Context but whose resources are adjusted to match the metrics of the given Display. (Inherited from ContextWrapper) |
CreatePackageContext(String, PackageContextFlags) |
Return a new Context object for the given application name. (Inherited from ContextWrapper) |
CreatePendingResult(Int32, Intent, PendingIntentFlags) |
Create a new PendingIntent object which you can hand to others
for them to use to send result data back to your
|
CreateWindowContext(Display, Int32, Bundle) |
Creates a |
CreateWindowContext(Int32, Bundle) |
Creates a Context for a non-activity window. (Inherited from Context) |
DatabaseList() |
Returns an array of strings naming the private databases associated with this Context's application package. (Inherited from ContextWrapper) |
DeleteDatabase(String) |
Delete an existing private SQLiteDatabase associated with this Context's application package. (Inherited from ContextWrapper) |
DeleteFile(String) |
Delete the given private file associated with this Context's application package. (Inherited from ContextWrapper) |
DeleteSharedPreferences(String) | (Inherited from ContextWrapper) |
DismissDialog(Int32) |
Obsolete.
Dismiss a dialog that was previously shown via |
DismissKeyboardShortcutsHelper() |
Dismiss the Keyboard Shortcuts screen. |
DispatchGenericMotionEvent(MotionEvent) |
Called to process generic motion events. |
DispatchKeyEvent(KeyEvent) |
Called to process key events. |
DispatchKeyShortcutEvent(KeyEvent) |
Called to process a key shortcut event. |
DispatchPopulateAccessibilityEvent(AccessibilityEvent) |
Called to process population of AccessibilityEvents. |
DispatchTouchEvent(MotionEvent) |
Called to process touch screen events. |
DispatchTrackballEvent(MotionEvent) |
Called to process trackball events. |
Dispose() | (Inherited from Object) |
Dispose(Boolean) | (Inherited from Object) |
Dump(String, FileDescriptor, PrintWriter, String[]) |
Print the Activity's state into the given stream. |
EnforceCallingOrSelfPermission(String, String) |
If neither you nor the calling process of an IPC you are handling has been granted a particular permission, throw a SecurityException. (Inherited from ContextWrapper) |
EnforceCallingOrSelfUriPermission(Uri, ActivityFlags, String) |
If the calling process of an IPC or you has not been granted permission to access a specific URI, throw SecurityException. (Inherited from ContextWrapper) |
EnforceCallingPermission(String, String) |
If the calling process of an IPC you are handling has not been granted a particular permission, throw a SecurityException. (Inherited from ContextWrapper) |
EnforceCallingUriPermission(Uri, ActivityFlags, String) |
If the calling process and user ID has not been granted permission to access a specific URI, throw SecurityException. (Inherited from ContextWrapper) |
EnforcePermission(String, Int32, Int32, String) |
If the given permission is not allowed for a particular process and user ID running in the system, throw a SecurityException. (Inherited from ContextWrapper) |
EnforceUriPermission(Uri, Int32, Int32, ActivityFlags, String) |
If a particular process and user ID has not been granted permission to access a specific URI, throw SecurityException. (Inherited from ContextWrapper) |
EnforceUriPermission(Uri, String, String, Int32, Int32, ActivityFlags, String) |
Enforce both a Uri and normal permission. (Inherited from ContextWrapper) |
EnterPictureInPictureMode() |
Puts the activity in picture-in-picture mode if possible in the current system state. |
EnterPictureInPictureMode(PictureInPictureParams) |
Puts the activity in picture-in-picture mode if possible in the current system state. |
Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
FileList() |
Returns an array of strings naming the private files associated with this Context's application package. (Inherited from ContextWrapper) |
FindViewById(Int32) |
Finds a view that was identified by the |
FindViewById<T>(Int32) |
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(Int32) |
Force finish another activity that you had previously started with
|
FinishActivityFromChild(Activity, Int32) |
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 root activity of the task. |
FinishFromChild(Activity) |
This is called when a child activity of this one calls its
|
GetColor(Int32) |
Returns a color associated with a particular resource ID and styled for the current theme. (Inherited from Context) |
GetColorStateList(Int32) |
Returns a color state list associated with a particular resource ID and styled for the current theme. (Inherited from Context) |
GetDatabasePath(String) | (Inherited from ContextWrapper) |
GetDir(String, FileCreationMode) |
Retrieve, creating if needed, a new directory in which the application can place its own custom data files. (Inherited from ContextWrapper) |
GetDrawable(Int32) |
Returns a drawable object associated with a particular resource ID and styled for the current theme. (Inherited from Context) |
GetExternalCacheDirs() |
Returns absolute paths to application-specific directories on all external storage devices where the application can place cache files it owns. (Inherited from ContextWrapper) |
GetExternalFilesDir(String) |
Returns the absolute path to the directory on the primary external filesystem (that is somewhere on ExternalStorageDirectory) where the application can place persistent files it owns. (Inherited from ContextWrapper) |
GetExternalFilesDirs(String) |
Returns absolute paths to application-specific directories on all external storage devices where the application can place persistent files it owns. (Inherited from ContextWrapper) |
GetExternalMediaDirs() |
Obsolete.
Returns absolute paths to application-specific directories on all external storage devices where the application can place media files. (Inherited from ContextWrapper) |
GetFileStreamPath(String) |
Returns the absolute path on the filesystem where a file created with OpenFileOutput(String, FileCreationMode) is stored. (Inherited from ContextWrapper) |
GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
GetObbDirs() |
Returns absolute paths to application-specific directories on all external storage devices where the application's OBB files (if there are any) can be found. (Inherited from ContextWrapper) |
GetPreferences(FileCreationMode) |
Retrieve a |
GetSharedPreferences(String, FileCreationMode) |
Retrieve and hold the contents of the preferences file 'name', returning a SharedPreferences through which you can retrieve and modify its values. (Inherited from ContextWrapper) |
GetString(Int32, Object[]) |
Returns a localized string from the application's package's default string table. (Inherited from Context) |
GetString(Int32) |
Returns a localized string from the application's package's default string table. (Inherited from Context) |
GetSystemService(Class) |
Return the handle to a system-level service by class. (Inherited from Context) |
GetSystemService(String) |
Return the handle to a system-level service by name. (Inherited from ContextWrapper) |
GetSystemServiceName(Class) | (Inherited from ContextWrapper) |
GetText(Int32) |
Return a localized, styled CharSequence from the application's package's default string table. (Inherited from Context) |
GetTextFormatted(Int32) |
Return a localized, styled CharSequence from the application's package's default string table. (Inherited from Context) |
GrantUriPermission(String, Uri, ActivityFlags) |
Grant permission to access a specific Uri to another package, regardless of whether that package has general permission to access the Uri's content provider. (Inherited from ContextWrapper) |
InvalidateOptionsMenu() |
Declare that the options menu has changed, so should be recreated. |
JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
ManagedQuery(Uri, String[], String, String[], String) |
Obsolete.
Wrapper around
|
MoveDatabaseFrom(Context, String) | (Inherited from ContextWrapper) |
MoveSharedPreferencesFrom(Context, String) | (Inherited from ContextWrapper) |
MoveTaskToBack(Boolean) |
Move the task containing this activity to the back of the activity stack. |
NavigateUpTo(Intent) |
Navigate from this activity to the activity specified by upIntent, finishing this activity in the process. |
NavigateUpToFromChild(Activity, Intent) |
This is called when a child activity of this one calls its
|
Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
ObtainStyledAttributes(IAttributeSet, Int32[], Int32, Int32) |
Retrieve styled attribute information in this Context's theme. (Inherited from Context) |
ObtainStyledAttributes(IAttributeSet, Int32[]) |
Retrieve styled attribute information in this Context's theme. (Inherited from Context) |
ObtainStyledAttributes(Int32, Int32[]) |
Retrieve styled attribute information in this Context's theme. (Inherited from Context) |
ObtainStyledAttributes(Int32[]) |
Retrieve styled attribute information in this Context's theme. (Inherited from Context) |
OnActionModeFinished(ActionMode) |
Notifies the activity that an action mode has finished. |
OnActionModeStarted(ActionMode) |
Notifies the Activity that an action mode has been started. |
OnActivityReenter(Int32, 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. |
OnActivityResult(Int32, Result, 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. |
OnApplyThemeResource(Resources+Theme, Int32, Boolean) |
Called by |
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 |
OnBackPressed() |
Called when the activity has detected the user's press of the back key. |
OnChildTitleChanged(Activity, ICharSequence) | |
OnChildTitleChanged(Activity, String) | |
OnConfigurationChanged(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 M:Android.Views.Window.SetContentView(Android.Views.View,.LayoutParams) or AddContentView(View, ViewGroup+LayoutParams)). |
OnContextItemSelected(IMenuItem) |
This hook is called whenever an item in a context menu is selected. |
OnContextMenuClosed(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(Bundle, PersistableBundle) |
Same as |
OnCreate(Bundle) |
Called when the activity is starting. |
OnCreateContextMenu(IContextMenu, View, IContextMenuContextMenuInfo) |
Called when a context menu for the |
OnCreateDescription() |
Generate a new description for this activity. |
OnCreateDescriptionFormatted() |
Generate a new description for this activity. |
OnCreateDialog(Int32, Bundle) |
Obsolete.
Callback for creating dialogs that are managed (saved and restored) for you by the activity. |
OnCreateDialog(Int32) |
Obsolete.
This member is deprecated. |
OnCreateNavigateUpTaskStack(TaskStackBuilder) |
Define the synthetic task stack that will be generated during Up navigation from a different task. |
OnCreateOptionsMenu(IMenu) |
Initialize the contents of the Activity's standard options menu. |
OnCreatePanelMenu(Int32, IMenu) |
Default implementation of
|
OnCreatePanelView(Int32) |
Default implementation of
|
OnCreateThumbnail(Bitmap, Canvas) |
This member is deprecated. |
OnCreateView(String, Context, IAttributeSet) |
Standard implementation of
|
OnCreateView(View, String, Context, IAttributeSet) |
Standard implementation of
|
OnDestroy() |
Perform any final cleanup before an activity is destroyed. |
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(MotionEvent) |
Called when a generic motion event was not handled by any of the views inside of the activity. |
OnGetDirectActions(CancellationSignal, IConsumer) |
Returns the list of direct actions supported by the app. |
OnKeyDown(Keycode, KeyEvent) |
Called when a key was pressed down and not handled by any of the views inside of the activity. |
OnKeyLongPress(Keycode, KeyEvent) |
Default implementation of |
OnKeyMultiple(Keycode, Int32, KeyEvent) |
Default implementation of |
OnKeyShortcut(Keycode, KeyEvent) |
Called when a key shortcut event is not handled by any of the views in the Activity. |
OnKeyUp(Keycode, KeyEvent) |
Called when a key was released and not handled by any of the views inside of the activity. |
OnLocalVoiceInteractionStarted() |
Callback to indicate that |
OnLocalVoiceInteractionStopped() |
Callback to indicate that the local voice interaction has stopped either
because it was requested through a call to |
OnLowMemory() |
This is called when the overall system is running low on memory, and actively running processes should trim their memory usage. |
OnMenuItemSelected(Int32, IMenuItem) |
Default implementation of
|
OnMenuOpened(Int32, IMenu) |
To be added |
OnMultiWindowModeChanged(Boolean, Configuration) |
Called by the system when the activity changes from fullscreen mode to multi-window mode and visa-versa. |
OnMultiWindowModeChanged(Boolean) |
Called by the system when the activity changes from fullscreen mode to multi-window mode and visa-versa. |
OnNavigateUp() |
This method is called whenever the user chooses to navigate Up within your application's activity hierarchy from the action bar. |
OnNavigateUpFromChild(Activity) |
This is called when a child activity of this one attempts to navigate up. |
OnNewIntent(Intent) |
This is called for activities that set launchMode to "singleTop" in
their package, or if a client used the |
OnOptionsItemSelected(IMenuItem) |
This hook is called whenever an item in your options menu is selected. |
OnOptionsMenuClosed(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(Int32, IMenu) |
Default implementation of
|
OnPause() |
Called as part of the activity lifecycle when the user no longer actively interacts with the activity, but it is still visible on screen. |
OnPerformDirectAction(String, Bundle, CancellationSignal, IConsumer) |
This is called to perform an action previously defined by the app. |
OnPictureInPictureModeChanged(Boolean, Configuration) |
Called by the system when the activity changes to and from picture-in-picture mode. |
OnPictureInPictureModeChanged(Boolean) |
Called by the system when the activity changes to and from picture-in-picture mode. |
OnPictureInPictureRequested() |
This method is called by the system in various cases where picture in picture mode should be entered if supported. |
OnPictureInPictureUiStateChanged(PictureInPictureUiState) |
Called by the system when the activity is in PiP and has state changes. |
OnPostCreate(Bundle, PersistableBundle) |
This is the same as |
OnPostCreate(Bundle) |
Called when activity start-up is complete (after |
OnPostResume() |
Called when activity resume is complete (after |
OnPrepareDialog(Int32, Dialog, Bundle) |
Obsolete.
Provides an opportunity to prepare a managed dialog before it is being shown. |
OnPrepareDialog(Int32, Dialog) |
Obsolete.
This member is deprecated. |
OnPrepareNavigateUpTaskStack(TaskStackBuilder) |
Prepare the synthetic task stack that will be generated during Up navigation from a different task. |
OnPrepareOptionsMenu(IMenu) |
Prepare the Screen's standard options menu to be displayed. |
OnPreparePanel(Int32, View, IMenu) |
Default implementation of
|
OnProvideAssistContent(AssistContent) |
This is called when the user is requesting an assist, to provide references to content related to the current activity. |
OnProvideAssistData(Bundle) |
This is called when the user is requesting an assist, to build a full
|
OnProvideKeyboardShortcuts(IList<KeyboardShortcutGroup>, IMenu, Int32) | |
OnProvideReferrer() |
Override to generate the desired referrer for the content currently being shown by the app. |
OnRequestPermissionsResult(Int32, String[], Permission[]) |
Callback for the result from requesting permissions. |
OnRestart() |
Called after |
OnRestoreInstanceState(Bundle, PersistableBundle) |
This is the same as |
OnRestoreInstanceState(Bundle) |
This method is called after |
OnResume() |
Called after |
OnRetainNonConfigurationInstance() |
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(Bundle, PersistableBundle) |
This is the same as |
OnSaveInstanceState(Bundle) |
Called to retrieve per-instance state from an activity before being killed
so that the state can be restored in |
OnSearchRequested() |
Called when the user signals the desire to start a search. |
OnSearchRequested(SearchEvent) |
This hook is called when the user signals the desire to start a search. |
OnStart() |
Called after |
OnStateNotSaved() |
Called when an |
OnStop() |
Called when you are no longer visible to the user. |
OnTitleChanged(ICharSequence, Color) | |
OnTitleChanged(String, Color) | |
OnTopResumedActivityChanged(Boolean) |
Called when activity gets or loses the top resumed position in the system. |
OnTouchEvent(MotionEvent) |
Called when a touch screen event was not handled by any of the views inside of the activity. |
OnTrackballEvent(MotionEvent) |
Called when the trackball was moved and not handled by any of the views inside of the activity. |
OnTrimMemory(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. |
OnUserLeaveHint() |
Called as part of the activity lifecycle when an activity is about to go into the background as the result of user choice. |
OnVisibleBehindCanceled() |
Called when a translucent activity over this activity is becoming opaque or another activity is being launched. |
OnWindowAttributesChanged(WindowManagerLayoutParams) |
This is called whenever the current window attributes change. |
OnWindowFocusChanged(Boolean) |
Called when the current |
OnWindowStartingActionMode(ActionMode+ICallback, ActionModeType) |
Give the Activity a chance to control the UI for an action mode requested by the system. |
OnWindowStartingActionMode(ActionMode+ICallback) |
Give the Activity a chance to control the UI for an action mode requested by the system. |
OpenContextMenu(View) |
Programmatically opens the context menu for a particular |
OpenFileInput(String) |
Open a private file associated with this Context's application package for reading. (Inherited from ContextWrapper) |
OpenFileOutput(String, FileCreationMode) |
Open a private file associated with this Context's application package for writing. (Inherited from ContextWrapper) |
OpenOptionsMenu() |
Programmatically opens the options menu. |
OpenOrCreateDatabase(String, FileCreationMode, SQLiteDatabase+ICursorFactory, IDatabaseErrorHandler) |
Open a new private SQLiteDatabase associated with this Context's application package. (Inherited from ContextWrapper) |
OpenOrCreateDatabase(String, FileCreationMode, SQLiteDatabase+ICursorFactory) |
Open a new private SQLiteDatabase associated with this Context's application package. (Inherited from ContextWrapper) |
OverrideActivityTransition(OverrideTransition, Int32, Int32, Int32) |
Customizes the animation for the activity transition with this activity. |
OverrideActivityTransition(OverrideTransition, Int32, Int32) |
Customizes the animation for the activity transition with this activity. |
OverridePendingTransition(Int32, Int32, Int32) |
Call immediately after one of the flavors of |
OverridePendingTransition(Int32, Int32) |
Call immediately after one of the flavors of |
PeekWallpaper() |
Obsolete.
(Inherited from ContextWrapper)
|
PostponeEnterTransition() |
Postpone the entering activity transition when Activity was started with
|
Recreate() |
Cause this Activity to be recreated with a new instance. |
RegisterActivityLifecycleCallbacks(Application+IActivityLifecycleCallbacks) |
Register an |
RegisterComponentCallbacks(IComponentCallbacks) |
Add a new |
RegisterDeviceIdChangeListener(IExecutor, IIntConsumer) |
Adds a new device ID changed listener to the |
RegisterForContextMenu(View) |
Registers a context menu to be shown for the given view (multiple views can show the context menu). |
RegisterReceiver(BroadcastReceiver, IntentFilter, ActivityFlags) |
Obsolete.
(Inherited from ContextWrapper)
|
RegisterReceiver(BroadcastReceiver, IntentFilter, ReceiverFlags) | (Inherited from Context) |
RegisterReceiver(BroadcastReceiver, IntentFilter, String, Handler, ActivityFlags) |
Obsolete.
(Inherited from ContextWrapper)
|
RegisterReceiver(BroadcastReceiver, IntentFilter, String, Handler, ReceiverFlags) | (Inherited from Context) |
RegisterReceiver(BroadcastReceiver, IntentFilter, String, Handler) |
Register to receive intent broadcasts, to run in the context of scheduler. (Inherited from ContextWrapper) |
RegisterReceiver(BroadcastReceiver, IntentFilter) |
Register a BroadcastReceiver to be run in the main activity thread. (Inherited from ContextWrapper) |
RegisterScreenCaptureCallback(IExecutor, Activity+IScreenCaptureCallback) | |
ReleaseInstance() |
Ask that the local app instance of this activity be released to free up its memory. |
RemoveDialog(Int32) |
Obsolete.
Removes any internal references to a dialog managed by this Activity. |
RemoveStickyBroadcast(Intent) |
Obsolete.
(Inherited from ContextWrapper)
|
RemoveStickyBroadcastAsUser(Intent, UserHandle) |
Obsolete.
(Inherited from ContextWrapper)
|
ReportFullyDrawn() |
Report to the system that your app is now fully drawn, for diagnostic and optimization purposes. |
RequestDragAndDropPermissions(DragEvent) |
Create |
RequestFullscreenMode(FullscreenModeRequest, IOutcomeReceiver) |
Request to put the a freeform activity into fullscreen. |
RequestPermissions(String[], Int32) |
Requests permissions to be granted to this application. |
RequestShowKeyboardShortcuts() |
Request the Keyboard Shortcuts screen to show up. |
RequestVisibleBehind(Boolean) |
Activities that want to remain visible behind a translucent activity above them must call
this method anytime between the start of |
RequestWindowFeature(WindowFeatures) |
Enable extended window features. |
RequireViewById(Int32) |
Finds a view that was identified by the |
RequireViewById<T>(Int32) | |
RevokeSelfPermissionOnKill(String) |
Triggers the asynchronous revocation of a runtime permission. (Inherited from Context) |
RevokeSelfPermissionsOnKill(ICollection<String>) |
Triggers the revocation of one or more permissions for the calling package. (Inherited from Context) |
RevokeUriPermission(String, Uri, ActivityFlags) | (Inherited from ContextWrapper) |
RevokeUriPermission(Uri, ActivityFlags) |
Remove all permissions to access a particular content provider Uri that were previously added with M:Android.Content.Context.GrantUriPermission(System.String,Android.Net.Uri,Android.Net.Uri). (Inherited from ContextWrapper) |
RunOnUiThread(Action) | |
RunOnUiThread(IRunnable) |
Runs the specified action on the UI thread. |
SendBroadcast(Intent, String, Bundle) |
Broadcast the given intent to all interested BroadcastReceivers, allowing an optional required permission to be enforced. (Inherited from Context) |
SendBroadcast(Intent, String) |
Broadcast the given intent to all interested BroadcastReceivers, allowing an optional required permission to be enforced. (Inherited from ContextWrapper) |
SendBroadcast(Intent) |
Broadcast the given intent to all interested BroadcastReceivers. (Inherited from ContextWrapper) |
SendBroadcastAsUser(Intent, UserHandle, String) |
Version of SendBroadcast(Intent, String) that allows you to specify the user the broadcast will be sent to. (Inherited from ContextWrapper) |
SendBroadcastAsUser(Intent, UserHandle) |
Version of SendBroadcast(Intent) that allows you to specify the user the broadcast will be sent to. (Inherited from ContextWrapper) |
SendBroadcastWithMultiplePermissions(Intent, String[]) |
Broadcast the given intent to all interested BroadcastReceivers, allowing an array of required permissions to be enforced. (Inherited from Context) |
SendOrderedBroadcast(Intent, Int32, String, String, BroadcastReceiver, Handler, String, Bundle, Bundle) | (Inherited from ContextWrapper) |
SendOrderedBroadcast(Intent, String, BroadcastReceiver, Handler, Result, String, Bundle) |
Version of SendBroadcast(Intent) that allows you to receive data back from the broadcast. (Inherited from ContextWrapper) |
SendOrderedBroadcast(Intent, String, Bundle, BroadcastReceiver, Handler, Result, String, Bundle) |
Version of |
SendOrderedBroadcast(Intent, String, Bundle) |
Broadcast the given intent to all interested BroadcastReceivers, delivering them one at a time to allow more preferred receivers to consume the broadcast before it is delivered to less preferred receivers. (Inherited from Context) |
SendOrderedBroadcast(Intent, String, String, BroadcastReceiver, Handler, Result, String, Bundle) |
Version of
|
SendOrderedBroadcast(Intent, String) | (Inherited from ContextWrapper) |
SendOrderedBroadcastAsUser(Intent, UserHandle, String, BroadcastReceiver, Handler, Result, String, Bundle) | (Inherited from ContextWrapper) |
SendStickyBroadcast(Intent, Bundle) |
Perform a |
SendStickyBroadcast(Intent) |
Obsolete.
Perform a |
SendStickyBroadcastAsUser(Intent, UserHandle) |
Obsolete.
(Inherited from ContextWrapper)
|
SendStickyOrderedBroadcast(Intent, BroadcastReceiver, Handler, Result, String, Bundle) |
Obsolete.
(Inherited from ContextWrapper)
|
SendStickyOrderedBroadcastAsUser(Intent, UserHandle, BroadcastReceiver, Handler, Result, String, Bundle) |
Obsolete.
(Inherited from ContextWrapper)
|
SetActionBar(Toolbar) |
Set a |
SetContentView(Int32) |
Set the activity content from a layout resource. |
SetContentView(View, ViewGroup+LayoutParams) |
Set the activity content from a layout resource. |
SetContentView(View) |
Set the activity content to an explicit view. |
SetDefaultKeyMode(DefaultKey) |
Select the default key handling for this activity. |
SetEnterSharedElementCallback(SharedElementCallback) |
When |
SetExitSharedElementCallback(SharedElementCallback) |
When |
SetFeatureDrawable(WindowFeatures, Drawable) |
Convenience for calling
|
SetFeatureDrawableAlpha(WindowFeatures, Int32) |
Convenience for calling
|
SetFeatureDrawableResource(WindowFeatures, Int32) |
Convenience for calling
|
SetFeatureDrawableUri(WindowFeatures, Uri) |
Convenience for calling
|
SetFinishOnTouchOutside(Boolean) |
Sets whether this activity is finished when touched outside its window's bounds. |
SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
SetInheritShowWhenLocked(Boolean) |
Specifies whether this |
SetLocusContext(LocusId, Bundle) |
Sets the |
SetPersistent(Boolean) |
This member is deprecated. |
SetPictureInPictureParams(PictureInPictureParams) |
Updates the properties of the picture-in-picture activity, or sets it to be used later when
|
SetProgress(Int32) |
Sets the progress for the progress bars in the title. |
SetProgressBarIndeterminate(Boolean) |
Sets whether the horizontal progress bar in the title should be indeterminate (the circular is always indeterminate). |
SetProgressBarIndeterminateVisibility(Boolean) |
Sets the visibility of the indeterminate progress bar in the title. |
SetProgressBarVisibility(Boolean) |
Sets the visibility of the progress bar in the title. |
SetRecentsScreenshotEnabled(Boolean) |
If set to false, this indicates to the system that it should never take a screenshot of the activity to be used as a representation in recents screen. |
SetResult(Result, Intent) |
Call this to set the result that your activity will return to its caller. |
SetResult(Result) |
Call this to set the result that your activity will return to its caller. |
SetSecondaryProgress(Int32) |
Sets the secondary progress for the progress bar in the title. |
SetShouldDockBigOverlays(Boolean) |
Specifies a preference to dock big overlays like the expanded picture-in-picture on TV
(see |
SetShowWhenLocked(Boolean) |
Specifies whether an |
SetTaskDescription(ActivityManager+TaskDescription) |
Sets information describing the task with this activity for presentation inside the Recents System UI. |
SetTheme(Int32) |
Set the base theme for this context. (Inherited from ContextWrapper) |
SetTheme(Resources+Theme) |
Set the configure the current theme. (Inherited from ContextThemeWrapper) |
SetTitle(Int32) |
Change the title associated with this activity. |
SetTranslucent(Boolean) |
Convert an activity, which particularly with |
SetTurnScreenOn(Boolean) |
Specifies whether the screen should be turned on when the |
SetVisible(Boolean) |
Control whether this activity's main window is visible. |
SetVrModeEnabled(Boolean, ComponentName) |
Enable or disable virtual reality (VR) mode for this Activity. |
SetWallpaper(Bitmap) |
Obsolete.
(Inherited from ContextWrapper)
|
SetWallpaper(Stream) |
Obsolete.
(Inherited from ContextWrapper)
|
ShouldDockBigOverlays() |
Returns whether big overlays should be docked next to the activity as set by
|
ShouldShowRequestPermissionRationale(String) |
Gets whether you should show UI with rationale before requesting a permission. |
ShouldUpRecreateTask(Intent) |
Returns true if the app should recreate the task when navigating 'up' from this activity by using targetIntent. |
ShowAssist(Bundle) |
Ask to have the current assistant shown to the user. |
ShowDialog(Int32, Bundle) |
Obsolete.
Show a dialog managed by this activity. |
ShowDialog(Int32) |
Obsolete.
Simple version of |
ShowLockTaskEscapeMessage() |
Shows the user the system defined message for telling the user how to exit lock task mode. |
StartActionMode(ActionMode+ICallback, ActionModeType) |
Start an action mode of the default type |
StartActionMode(ActionMode+ICallback) |
Start an action mode of the default type |
StartActivities(Intent[], Bundle) |
Launch multiple new activities. (Inherited from ContextWrapper) |
StartActivities(Intent[]) |
Same as StartActivities(Intent[], Bundle) with no options specified. (Inherited from ContextWrapper) |
StartActivity(Intent, Bundle) |
Launch a new activity. (Inherited from ContextWrapper) |
StartActivity(Intent) |
Same as StartActivity(Intent, Bundle) with no options specified. (Inherited from ContextWrapper) |
StartActivity(Type) | (Inherited from Context) |
StartActivityForResult(Intent, Int32, Bundle) |
Launch an activity for which you would like a result when it finished. |
StartActivityForResult(Intent, Int32) |
Same as calling |
StartActivityForResult(Type, Int32) | |
StartActivityFromChild(Activity, Intent, Int32, Bundle) |
This is called when a child activity of this one calls its
|
StartActivityFromChild(Activity, Intent, Int32) |
Same as calling |
StartActivityFromFragment(Fragment, Intent, Int32, Bundle) |
This is called when a Fragment in this activity calls its
|
StartActivityFromFragment(Fragment, Intent, Int32) |
Same as calling |
StartActivityIfNeeded(Intent, Int32, Bundle) |
A special variation to launch an activity only if a new activity instance is needed to handle the given Intent. |
StartActivityIfNeeded(Intent, Int32) |
Same as calling |
StartForegroundService(Intent) | (Inherited from ContextWrapper) |
StartInstrumentation(ComponentName, String, Bundle) |
Start executing an Instrumentation class. (Inherited from ContextWrapper) |
StartIntentSender(IntentSender, Intent, ActivityFlags, ActivityFlags, Int32, Bundle) |
Like StartActivity(Intent, Bundle), but taking a IntentSender to start. (Inherited from ContextWrapper) |
StartIntentSender(IntentSender, Intent, ActivityFlags, ActivityFlags, Int32) | (Inherited from ContextWrapper) |
StartIntentSenderForResult(IntentSender, Int32, Intent, ActivityFlags, ActivityFlags, Int32, Bundle) |
Like |
StartIntentSenderForResult(IntentSender, Int32, Intent, ActivityFlags, ActivityFlags, Int32) |
Same as calling |
StartIntentSenderFromChild(Activity, IntentSender, Int32, Intent, ActivityFlags, ActivityFlags, Int32, Bundle) |
Like |
StartIntentSenderFromChild(Activity, IntentSender, Int32, Intent, ActivityFlags, ActivityFlags, Int32) |
Same as calling |
StartLocalVoiceInteraction(Bundle) |
Starts a local voice interaction session. |
StartLockTask() |
Request to put this activity in a mode where the user is locked to a restricted set of applications. |
StartManagingCursor(ICursor) |
Obsolete.
This method allows the activity to take care of managing the given
|
StartNextMatchingActivity(Intent, Bundle) |
Special version of starting an activity, for use when you are replacing other activity components. |
StartNextMatchingActivity(Intent) |
Same as calling |
StartPostponedEnterTransition() |
Begin postponed transitions after |
StartSearch(String, Boolean, Bundle, Boolean) |
This hook is called to launch the search UI. |
StartService(Intent) |
Request that a given application service be started. (Inherited from ContextWrapper) |
StopLocalVoiceInteraction() |
Request to terminate the current voice interaction that was previously started
using |
StopLockTask() |
Stop the current task from being locked. |
StopManagingCursor(ICursor) |
Obsolete.
Given a Cursor that was previously given to
|
StopService(Intent) |
Request that a given application service be stopped. (Inherited from ContextWrapper) |
TakeKeyEvents(Boolean) |
Request that key events come to this activity. |
ToArray<T>() | (Inherited from Object) |
ToString() |
Returns a string representation of the object. (Inherited from Object) |
TriggerSearch(String, Bundle) |
Similar to |
UnbindService(IServiceConnection) |
Disconnect from an application service. (Inherited from ContextWrapper) |
UnregisterActivityLifecycleCallbacks(Application+IActivityLifecycleCallbacks) |
Unregister an |
UnregisterComponentCallbacks(IComponentCallbacks) |
Remove a |
UnregisterDeviceIdChangeListener(IIntConsumer) |
Removes a device ID changed listener from the Context. (Inherited from Context) |
UnregisterForContextMenu(View) |
Prevents a context menu to be shown for the given view. |
UnregisterFromRuntime() | (Inherited from Object) |
UnregisterReceiver(BroadcastReceiver) |
Unregister a previously registered BroadcastReceiver. (Inherited from ContextWrapper) |
UnregisterScreenCaptureCallback(Activity+IScreenCaptureCallback) | |
UpdateServiceGroup(IServiceConnection, Int32, Int32) |
For a service previously bound with |
Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Explicit Interface Implementations
IJavaPeerable.Disposed() | (Inherited from Object) |
IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |
IJavaPeerable.Finalized() | (Inherited from Object) |
IJavaPeerable.JniManagedPeerState | (Inherited from Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |
Extension Methods
JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
JavaCast<TResult>(IJavaObject) | |
GetJniTypeName(IJavaPeerable) |