Added in API level 1

android.app


Contains high-level classes encapsulating the overall Android application model.

An Android application is defined using one or more of Android's four core application components. Two such application components are defined in this package: Activity and Service. The other two components are from the android.content package: BroadcastReceiver and ContentProvider.

An Activity is an application component that provides a screen with which users can interact in order to do something, such as dial the phone, take a photo, send an email, or view a map. An activity can start other activities, including activities that live in separate applications.

A Service is an application component that can perform long-running operations in the background without a user interface. For example, a service can handle network transactions, play music, or work with a content provider without the user being aware of the work going on.

The Fragment class is also an important part of an application's design—especially when designing for large screen devices, such as tablets. A fragment defines a distinct part of an activity's behavior, including the associated UI. It has its own lifecycle that is similar to that of the activity and can exist alongside other fragments that are embedded in the activity. While an activity is running, you can add and remove fragments and include each fragment in a back stack that's managed by the activity—allowing the user to navigate backwards through the fragment states, without leaving the activity.

This package also defines application utilities, such as dialogs, notifications, and the action bar.

For information about using some the classes in this package, see the following documents: Activities, Services, Fragments, Using the Action Bar, Creating Dialogs, and Notifying the User.

Interfaces

ActionBar.OnMenuVisibilityListener Listener for receiving events when action bar menus are shown or hidden. 
ActionBar.OnNavigationListener This interface was deprecated in API level 21. Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead. 
ActionBar.TabListener This interface was deprecated in API level 21. Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead. 
Activity.ScreenCaptureCallback Interface for observing screen captures of an Activity
AlarmManager.OnAlarmListener Direct-notification alarms: the requester must be running continuously from the time the alarm is set to the time it is delivered, or delivery will fail. 
Application.ActivityLifecycleCallbacks  
Application.OnProvideAssistDataListener Callback interface for use with Application.registerOnProvideAssistDataListener and Application.unregisterOnProvideAssistDataListener
AppOpsManager.OnOpActiveChangedListener Callback for notification of changes to operation active state. 
AppOpsManager.OnOpChangedListener Callback for notification of changes to operation state. 
DatePickerDialog.OnDateSetListener The listener used to indicate the user has finished selecting a date. 
FragmentBreadCrumbs.OnBreadCrumbClickListener This interface was deprecated in API level 28. This widget is no longer supported. 
FragmentManager.BackStackEntry This interface was deprecated in API level 28. Use the Support Library FragmentManager.BackStackEntry 
FragmentManager.OnBackStackChangedListener This interface was deprecated in API level 28. Use the Support Library FragmentManager.OnBackStackChangedListener 
KeyguardManager.KeyguardLockedStateListener Listener for keyguard locked state changes. 
KeyguardManager.OnKeyguardExitResult This interface was deprecated in API level 26. Use KeyguardDismissCallback 
LoaderManager.LoaderCallbacks<D> This interface was deprecated in API level 28. Use the Support Library LoaderManager.LoaderCallbacks 
Notification.Action.Extender Extender interface for use with Builder.extend
Notification.Extender Extender interface for use with Builder.extend
PendingIntent.OnFinished Callback interface for discovering when a send operation has completed. 
SearchManager.OnCancelListener See SearchManager.setOnCancelListener for configuring your activity to monitor search UI state. 
SearchManager.OnDismissListener See SearchManager.setOnDismissListener for configuring your activity to monitor search UI state. 
SharedElementCallback.OnSharedElementsReadyListener Listener to be called after SharedElementCallback.onSharedElementsArrived(java.util.List, java.util.List, android.app.SharedElementCallback.OnSharedElementsReadyListener) when the shared elements are ready to be hidden in the source Activity and shown in the destination Activity. 
TimePickerDialog.OnTimeSetListener The callback interface used to indicate the user is done filling in the time (e.g. they clicked on the 'OK' button). 
UiAutomation.AccessibilityEventFilter Listener for filtering accessibility events. 
UiAutomation.OnAccessibilityEventListener Listener for observing the AccessibilityEvent stream. 
UiModeManager.ContrastChangeListener Listener for the UI contrast. 
WallpaperManager.OnColorsChangedListener Interface definition for a callback to be invoked when colors change on a wallpaper. 
ZygotePreload This is the interface to be implemented for the class that is specified by the android:zygotePreloadName of the <application> tag. 

Classes

ActionBar A primary toolbar within the activity that may display the activity title, application-level navigation affordances, and other interactive items. 
ActionBar.LayoutParams Per-child layout information associated with action bar custom views. 
ActionBar.Tab This class was deprecated in API level 21. Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead. 
Activity An activity is a single, focused thing that the user can do. 
ActivityGroup This class was deprecated in API level 13. Use the new Fragment and FragmentManager APIs instead; these are also available on older platforms through the Android compatibility package. 
ActivityManager

This class gives information about, and interacts with, activities, services, and the containing process. 

ActivityManager.AppTask The AppTask allows you to manage your own application's tasks. 
ActivityManager.MemoryInfo Information you can retrieve about the available memory through ActivityManager.getMemoryInfo
ActivityManager.ProcessErrorStateInfo Information you can retrieve about any processes that are in an error condition. 
ActivityManager.RecentTaskInfo Information you can retrieve about tasks that the user has most recently started or visited. 
ActivityManager.RunningAppProcessInfo Information you can retrieve about a running process. 
ActivityManager.RunningServiceInfo Information you can retrieve about a particular Service that is currently running in the system. 
ActivityManager.RunningTaskInfo Information you can retrieve about a particular task that is currently "running" in the system. 
ActivityManager.TaskDescription Information you can set and retrieve about the current activity within the recent task list. 
ActivityManager.TaskDescription.Builder Provides a convenient way to set the fields of a TaskDescription when creating a new instance. 
ActivityOptions Helper class for building an options Bundle that can be used with Context.startActivity(Intent, Bundle) and related methods. 
AlarmManager This class provides access to the system alarm services. 
AlarmManager.AlarmClockInfo An immutable description of a scheduled "alarm clock" event. 
AlertDialog A subclass of Dialog that can display one, two or three buttons. 
AlertDialog.Builder  
AliasActivity This class was deprecated in API level 30. Use <activity-alias> or subclass Activity directly. 
AppComponentFactory Interface used to control the instantiation of manifest elements. 
Application Base class for maintaining global application state. 
ApplicationErrorReport Describes an application error. 
ApplicationErrorReport.AnrInfo Describes an application not responding error. 
ApplicationErrorReport.BatteryInfo Describes a battery usage report. 
ApplicationErrorReport.CrashInfo Describes an application crash. 
ApplicationErrorReport.RunningServiceInfo Describes a running service report. 
ApplicationExitInfo Describes the information of an application process's death. 
ApplicationStartInfo Describes information related to an application process's startup. 
AppOpsManager App-ops are used for two purposes: Access control and tracking. 
AppOpsManager.OnOpNotedCallback Callback an app can set to monitor the app-ops the system has tracked for it. 
AsyncNotedAppOp When an app-op is noted and the app the app-op is noted for has a AppOpsManager.OnOpNotedCallback registered the note-event needs to be delivered to the callback. 
AutomaticZenRule Rule instance information for a zen (aka DND or Attention Management) mode. 
AutomaticZenRule.Builder  
BroadcastOptions Helper class for building an options Bundle that can be used with Context.sendBroadcast(Intent) and related methods. 
ComponentCaller Represents the app that launched the component. 
DatePickerDialog A simple dialog containing an DatePicker
Dialog Base class for Dialogs. 
DialogFragment This class was deprecated in API level 28. Use the Support Library DialogFragment for consistent behavior across all devices and access to Lifecycle. 
DirectAction Represents an abstract action that can be perform on this app. 
DirectAction.Builder Builder for construction of DirectAction. 
DownloadManager The download manager is a system service that handles long-running HTTP downloads. 
DownloadManager.Query This class may be used to filter download manager queries. 
DownloadManager.Request This class contains all the information necessary to request a new download. 
ExpandableListActivity This class was deprecated in API level 30. Use RecyclerView or use ExpandableListView directly 
Fragment This class was deprecated in API level 28. Use the Jetpack Fragment Library Fragment for consistent behavior across all devices and access to Lifecycle. 
Fragment.SavedState This class was deprecated in API level 28. Use Fragment.SavedState 
FragmentBreadCrumbs This class was deprecated in API level 21. This widget is no longer supported. 
FragmentContainer This class was deprecated in API level 28. Use the Support Library FragmentContainer. 
FragmentController This class was deprecated in API level 28. Use the Support Library FragmentController 
FragmentHostCallback<E> This class was deprecated in API level 28. Use the Support Library FragmentHostCallback 
FragmentManager This class was deprecated in API level 28. Use the Support Library FragmentManager for consistent behavior across all devices and access to Lifecycle. 
FragmentManager.FragmentLifecycleCallbacks This class was deprecated in API level 28. Use the Support Library FragmentManager.FragmentLifecycleCallbacks 
FragmentManagerNonConfig This class was deprecated in API level 28. Use the Support Library FragmentManagerNonConfig 
FragmentTransaction This class was deprecated in API level 28. Use the Support Library FragmentTransaction 
GameManager The GameManager allows system apps to modify and query the game mode of apps. 
GameState State of the game passed to the GameManager. 
GrammaticalInflectionManager This class allow applications to control granular grammatical inflection settings (such as per-app grammatical gender). 
Instrumentation Base class for implementing application instrumentation code. 
Instrumentation.ActivityMonitor Information about a particular kind of Intent that is being monitored. 
Instrumentation.ActivityResult Description of a Activity execution result to return to the original activity. 
IntentService This class was deprecated in API level 30. IntentService is subject to all the background execution limits imposed with Android 8.0 (API level 26). Consider using WorkManager instead. 
KeyguardManager Class to manage and query the state of the lock screen (also known as Keyguard). 
KeyguardManager.KeyguardDismissCallback Callback passed to KeyguardManager.requestDismissKeyguard(Activity, KeyguardDismissCallback) to notify caller of result. 
KeyguardManager.KeyguardLock This class was deprecated in API level 15. Use R.attr.showWhenLocked or Activity.setShowWhenLocked(boolean) instead. This allows you to seamlessly occlude and unocclude the keyguard as your application moves in and out of the foreground and does not require that any special permissions be requested. 
LauncherActivity This class was deprecated in API level 30. Applications can implement this UI themselves using RecyclerView and PackageManager.queryIntentActivities(Intent, int) 
LauncherActivity.IconResizer Utility class to resize icons to match default icon size. 
LauncherActivity.ListItem An item in the list 
ListActivity This class was deprecated in API level 30. Use ListFragment or RecyclerView to implement your Activity instead. 
ListFragment This class was deprecated in API level 28. Use the Support Library ListFragment for consistent behavior across all devices and access to Lifecycle. 
LoaderManager This class was deprecated in API level 28. Use the Support Library LoaderManager 
LocalActivityManager This class was deprecated in API level 13. Use the new Fragment and FragmentManager APIs instead; these are also available on older platforms through the Android compatibility package. 
LocaleConfig The LocaleConfig of an application. 
LocaleManager This class gives access to system locale services. 
MediaRouteActionProvider The media route action provider displays a media route button in the application's ActionBar to allow the user to select routes and to control the currently selected route. 
MediaRouteButton  
NativeActivity Convenience for implementing an activity that will be implemented purely in native code. 
Notification A class that represents how a persistent notification is to be presented to the user using the NotificationManager
Notification.Action Structure to encapsulate a named action that can be shown as part of this notification. 
Notification.Action.Builder Builder class for Action objects. 
Notification.Action.WearableExtender Wearable extender for notification actions. 
Notification.BigPictureStyle Helper class for generating large-format notifications that include a large image attachment. 
Notification.BigTextStyle Helper class for generating large-format notifications that include a lot of text. 
Notification.BubbleMetadata Encapsulates the information needed to display a notification as a bubble. 
Notification.BubbleMetadata.Builder Builder to construct a BubbleMetadata object. 
Notification.Builder Builder class for Notification objects. 
Notification.CallStyle Helper class for generating large-format notifications that include a large image attachment. 
Notification.CarExtender

Helper class to add Android Auto extensions to notifications. 

Notification.CarExtender.Builder Builder class for CarExtender.UnreadConversation objects. 
Notification.CarExtender.UnreadConversation A class which holds the unread messages from a conversation. 
Notification.DecoratedCustomViewStyle Notification style for custom views that are decorated by the system

Instead of providing a notification that is completely custom, a developer can set this style and still obtain system decorations like the notification header with the expand affordance and actions. 

Notification.DecoratedMediaCustomViewStyle Notification style for media custom views that are decorated by the system

Instead of providing a media notification that is completely custom, a developer can set this style and still obtain system decorations like the notification header with the expand affordance and actions. 

Notification.InboxStyle Helper class for generating large-format notifications that include a list of (up to 5) strings. 
Notification.MediaStyle Notification style for media playback notifications. 
Notification.MessagingStyle Helper class for generating large-format notifications that include multiple back-and-forth messages of varying types between any number of people. 
Notification.MessagingStyle.Message  
Notification.Style An object that can apply a rich notification style to a Notification.Builder object. 
Notification.TvExtender

Helper class to add Android TV extensions to notifications. 

Notification.WearableExtender Helper class to add wearable extensions to notifications. 
NotificationChannel A representation of settings that apply to a collection of similarly themed notifications. 
NotificationChannelGroup A grouping of related notification channels. 
NotificationManager Class to notify the user of events that happen. 
NotificationManager.Policy Notification policy configuration. 
PendingIntent A description of an Intent and target action to perform with it. 
Person Provides an immutable reference to an entity that appears repeatedly on different surfaces of the platform. 
Person.Builder Builder for the immutable Person class. 
PictureInPictureParams Represents a set of parameters used to initialize and update an Activity in picture-in-picture mode. 
PictureInPictureParams.Builder Builder class for PictureInPictureParams objects. 
PictureInPictureUiState Used by Activity.onPictureInPictureUiStateChanged(PictureInPictureUiState)
Presentation Base class for presentations. 
ProgressDialog This class was deprecated in API level 26. ProgressDialog is a modal dialog, which prevents the user from interacting with the app. Instead of using this class, you should use a progress indicator like ProgressBar, which can be embedded in your app's UI. Alternatively, you can use a notification to inform the user of the task's progress. 
RemoteAction Represents a remote action that can be called from another process. 
RemoteInput A RemoteInput object specifies input to be collected from a user to be passed along with an intent inside a PendingIntent that is sent. 
RemoteInput.Builder Builder class for RemoteInput objects. 
SearchableInfo Searchability meta-data for an activity. 
SearchManager This class provides access to the system search services. 
Service A Service is an application component representing either an application's desire to perform a longer-running operation while not interacting with the user or to supply functionality for other applications to use. 
SharedElementCallback Listener provided in Activity.setEnterSharedElementCallback(SharedElementCallback) and Activity.setExitSharedElementCallback(SharedElementCallback) as well as Fragment.setEnterSharedElementCallback(SharedElementCallback) and Fragment.setExitSharedElementCallback(SharedElementCallback) to monitor the Shared element transitions. 
StatusBarManager Allows an app to control the status bar. 
SyncNotedAppOp Description of an app-op that was noted for the current process. 
TabActivity This class was deprecated in API level 13. New applications should use Fragments instead of this class; to continue to run on older devices, you can use the v4 support library which provides a version of the Fragment API that is compatible down to Build.VERSION_CODES.DONUT. 
TaskInfo Stores information about a particular Task. 
TaskStackBuilder Utility class for constructing synthetic back stacks for cross-task navigation on Android 3.0 and newer. 
TimePickerDialog A dialog that prompts the user for the time of day using a TimePicker
UiAutomation Class for interacting with the device's UI by simulation user actions and introspection of the screen content. 
UiModeManager This class provides access to the system uimode services. 
VoiceInteractor Interface for an Activity to interact with the user through voice. 
VoiceInteractor.AbortVoiceRequest Reports that the current interaction can not be complete with voice, so the application will need to switch to a traditional input UI. 
VoiceInteractor.CommandRequest Execute a vendor-specific command using the trusted system VoiceInteractionService. 
VoiceInteractor.CompleteVoiceRequest Reports that the current interaction was successfully completed with voice, so the application can report the final status to the user. 
VoiceInteractor.ConfirmationRequest Confirms an operation with the user via the trusted system VoiceInteractionService. 
VoiceInteractor.PickOptionRequest Select a single option from multiple potential options with the user via the trusted system VoiceInteractionService. 
VoiceInteractor.PickOptionRequest.Option Represents a single option that the user may select using their voice. 
VoiceInteractor.Prompt A set of voice prompts to use with the voice interaction system to confirm an action, select an option, or do similar operations. 
VoiceInteractor.Request Base class for voice interaction requests that can be submitted to the interactor. 
WallpaperColors Provides information about the colors of a wallpaper. 
WallpaperInfo This class is used to specify meta information of a wallpaper service. 
WallpaperManager Provides access to the system wallpaper. 

Exceptions

AuthenticationRequiredException Specialization of SecurityException that is thrown when authentication is needed from the end user before viewing the content. 
BackgroundServiceStartNotAllowedException Exception thrown when an app tries to start a background Service when it's not allowed to do so. 
ForegroundServiceStartNotAllowedException Exception thrown when an app tries to start a foreground Service when it's not allowed to do so. 
ForegroundServiceTypeException Base exception thrown when an app tries to start a foreground Service without a valid type. 
Fragment.InstantiationException This class was deprecated in API level 28. Use Fragment.InstantiationException 
InvalidForegroundServiceTypeException Exception thrown when an app tries to start a foreground Service with an invalid type. 
MissingForegroundServiceTypeException Exception thrown when an app tries to start a foreground Service without a type. 
PendingIntent.CanceledException Exception thrown when trying to send through a PendingIntent that has been canceled or is otherwise no longer able to execute the request. 
RecoverableSecurityException Specialization of SecurityException that contains additional information about how to involve the end user to recover from the exception. 
ServiceStartNotAllowedException Exception thrown when an app tries to start a Service when it's not allowed to do so. 
StartForegroundCalledOnStoppedServiceException Exception thrown when Service.startForeground is called on a service that's not actually started.