Android.OS Namespace

Remarks

Provides basic operating system services, message passing, and inter-process communication on the device.

Classes

TypeReason
AsyncTask

Developer Guides

Usage

java Example

 private class DownloadFilesTask extends AsyncTask<URL, Integer, Long> {
     protected Long doInBackground(URL... urls) {
         int count = urls.length;
         long totalSize = 0;
         for (int i = 0; i 

java Example

 new DownloadFilesTask().execute(url1, url2, url3);
 

AsyncTask's generic types

  1. Params, the type of the parameters sent to the task upon execution.
  2. Progress, the type of the progress units published during the background computation.
  3. Result, the type of the result of the background computation.

java Example

 private class MyTask extends AsyncTask<Void, Void, Void> { ... }
 

The 4 steps

  1. Android.OS.AsyncTask`3.onPreExecute() , invoked on the UI thread before the task is executed. This step is normally used to setup the task, for instance by showing a progress bar in the user interface.
  2. Android.OS.AsyncTask`3.doInBackground(Params...) , invoked on the background thread immediately after Android.OS.AsyncTask`3.onPreExecute() finishes executing. This step is used to perform background computation that can take a long time. The parameters of the asynchronous task are passed to this step. The result of the computation must be returned by this step and will be passed back to the last step. This step can also use Android.OS.AsyncTask`3.publishProgress(Progress...) to publish one or more units of progress. These values are published on the UI thread, in the Android.OS.AsyncTask`3.onProgressUpdate(Progress...) step.
  3. Android.OS.AsyncTask`3.onProgressUpdate(Progress...) , invoked on the UI thread after a call to Android.OS.AsyncTask`3.publishProgress(Progress...). The timing of the execution is undefined. This method is used to display any form of progress in the user interface while the background computation is still executing. For instance, it can be used to animate a progress bar or show logs in a text field.
  4. Android.OS.AsyncTask`3.onPostExecute(Result) , invoked on the UI thread after the background computation finishes. The result of the background computation is passed to this step as a parameter.

Cancelling a task

Threading rules

Memory observability

Order of execution

AsyncTask+StatusIndicates the current status of the task.
AsyncTask<TParams,TProgress,TResult>

Developer Guides

Usage

java Example

 private class DownloadFilesTask extends AsyncTask<URL, Integer, Long> {
     protected Long doInBackground(URL... urls) {
         int count = urls.length;
         long totalSize = 0;
         for (int i = 0; i 

java Example

 new DownloadFilesTask().execute(url1, url2, url3);
 

AsyncTask's generic types

  1. Params, the type of the parameters sent to the task upon execution.
  2. Progress, the type of the progress units published during the background computation.
  3. Result, the type of the result of the background computation.

java Example

 private class MyTask extends AsyncTask<Void, Void, Void> { ... }
 

The 4 steps

  1. Android.OS.AsyncTask`3.onPreExecute() , invoked on the UI thread before the task is executed. This step is normally used to setup the task, for instance by showing a progress bar in the user interface.
  2. Android.OS.AsyncTask`3.doInBackground(Params...) , invoked on the background thread immediately after Android.OS.AsyncTask`3.onPreExecute() finishes executing. This step is used to perform background computation that can take a long time. The parameters of the asynchronous task are passed to this step. The result of the computation must be returned by this step and will be passed back to the last step. This step can also use Android.OS.AsyncTask`3.publishProgress(Progress...) to publish one or more units of progress. These values are published on the UI thread, in the Android.OS.AsyncTask`3.onProgressUpdate(Progress...) step.
  3. Android.OS.AsyncTask`3.onProgressUpdate(Progress...) , invoked on the UI thread after a call to Android.OS.AsyncTask`3.publishProgress(Progress...). The timing of the execution is undefined. This method is used to display any form of progress in the user interface while the background computation is still executing. For instance, it can be used to animate a progress bar or show logs in a text field.
  4. Android.OS.AsyncTask`3.onPostExecute(Result) , invoked on the UI thread after the background computation finishes. The result of the background computation is passed to this step as a parameter.

Cancelling a task

Threading rules

Memory observability

Order of execution

BadParcelableExceptionThe object you are calling has died, because its hosting process no longer exists.
BaseBundleA mapping from String values to various types.
BatteryHealthEnumerates values returned by several types.
BatteryManagerThe BatteryManager class contains strings and constants used for values in the Android.Content.Intent.ActionBatteryChanged Intent, and provides a method for querying battery and charging properties.
BatteryPluggedEnumerates values returned by several types.
BatteryPropertyEnumerates values returned by several types.
BatteryStatusEnumerates values returned by several types.
BinderBase class for a remotable object, the core part of a lightweight remote procedure call mechanism defined by Android.OS.BinderConsts.
Binder+InterfaceConstsDocumentation for this section has not yet been entered.
BinderConstsBase interface for a remotable object, the core part of a lightweight remote procedure call mechanism designed for high performance when performing in-process and cross-process calls.
BuildInformation about the current build, extracted from system properties.
Build+VERSIONVarious version strings.
Build+VERSION_CODESEnumeration of the currently known SDK version codes.
BuildVersionCodesEnumerates values returned by several types and taken as a parameter of the Android.Views.InputMethods.EditorInfo.MakeCompatible member.
BundleA mapping from String values to various Parcelable types.
Bundle+InterfaceConstsDocumentation for this section has not yet been entered.
CancellationSignalProvides the ability to cancel an operation in progress.
CancellationSignal+IOnCancelListenerListens for cancellation.
ConditionVariableClass that implements the condition variable locking paradigm.
CountDownTimerSchedule a countdown until a time in the future, with regular notifications on intervals along the way.
DeadObjectExceptionThe object you are calling has died, because its hosting process no longer exists.
DebugProvides various debugging methods for Android applications, including tracing and allocation counts.
Debug+InstructionCountAPI for gathering and querying instruction counts.
Debug+MemoryInfoThis class is used to retrieved various statistics about the memory mappings for this process.
Debug+MemoryInfo+InterfaceConstsDocumentation for this section has not yet been entered.
DebugShowEnumerates values returned by several types and taken as a parameter of the Android.OS.Debug.PrintLoadedClasses member.
DebugTraceOptionsEnumerates values returned by the Android.OS.Debug.TraceCountAllocs, Android.OS.DebugTraceOptions.CountAllocs, and Android.OS.DebugTraceOptions.None members and taken as a parameter of the Android.OS.Debug.StartMethodTracing member.
DropBoxManagerEnqueues chunks of data (from various sources -- application crashes, kernel log records, etc.
DropBoxManager+EntryA single entry retrieved from the drop box.
DropBoxManager+Entry+InterfaceConstsDocumentation for this section has not yet been entered.
DropBoxManagerFlagsEnumerates values returned by several types and taken as a parameter of several types.
EnvironmentProvides access to environment variables.
FileObserverMonitors files (using ) to fire an event after files are accessed or changed by by any process on the device (including this one).
FileObserverEventsEnumerates values returned by several methods of Android.OS.FileObserverEvents and taken as a parameter of the Android.OS.FileObserver..ctor, and Android.OS.FileObserver.OnEvent members.
HandlerA Handler allows you to send and process Android.OS.Message and Runnable objects associated with a thread's Android.OS.MessageQueue.
Handler+ICallbackCallback interface you can use when instantiating a Handler to avoid having to implement your own subclass of Handler.
HandlerThreadHandy class for starting a new thread that has a looper.
IBinderBase interface for a remotable object, the core part of a lightweight remote procedure call mechanism designed for high performance when performing in-process and cross-process calls.
IBinderDeathRecipientInterface for receiving a callback when the process hosting an IBinder has gone away.
IInterfaceBase class for Binder interfaces.
IParcelableInterface for classes whose instances can be written to and restored from a Android.OS.Parcel.
IParcelableClassLoaderCreatorSpecialization of Android.OS.IParcelableCreator that allows you to receive the ClassLoader the object is being created in.
IParcelableCreatorInterface that must be implemented and provided as a public CREATOR field that generates instances of your Parcelable class from a Parcel.
LooperClass used to run a message loop for a thread.
MemoryFileMemoryFile is a wrapper for the Linux ashmem driver.
MessageDefines a message containing a description and arbitrary data object that can be sent to a Android.OS.Handler.
Message+InterfaceConstsDocumentation for this section has not yet been entered.
MessageQueueLow-level class holding the list of messages to be dispatched by a Android.OS.Looper.
MessageQueue+IIdleHandlerCallback interface for discovering when a thread is going to block waiting for more messages.
MessengerReference to a Handler, which others can use to send messages to it.
Messenger+InterfaceConstsDocumentation for this section has not yet been entered.
NetworkOnMainThreadExceptionThe exception that is thrown when an application attempts to perform a networking operation on its main thread.
OperationCanceledExceptionAn exception type that is thrown when an operation in progress is canceled.
ParcelContainer for a message (data and object references) that can be sent through an IBinder.
ParcelableInterface for classes whose instances can be written to and restored from a Android.OS.Parcel.
ParcelableConstsDocumentation for this section has not yet been entered.
ParcelableWriteFlagsEnumerates values returned by several types and taken as a parameter of several types.
ParcelFileDescriptorThe FileDescriptor returned by Android.OS.Parcel.ReadFileDescriptor, allowing you to close it when done with it.
ParcelFileDescriptor+AutoCloseInputStreamAn InputStream you can create on a ParcelFileDescriptor, which will take care of calling Android.OS.ParcelFileDescriptor.Close for you when the stream is closed.
ParcelFileDescriptor+AutoCloseOutputStreamAn OutputStream you can create on a ParcelFileDescriptor, which will take care of calling Android.OS.ParcelFileDescriptor.Close for you when the stream is closed.
ParcelFileDescriptor+CloseEventArgsDocumentation for this section has not yet been entered.
ParcelFileDescriptor+FileDescriptorDetachedExceptionDocumentation for this section has not yet been entered.
ParcelFileDescriptor+InterfaceConstsDocumentation for this section has not yet been entered.
ParcelFileDescriptor+IOnCloseListenerDocumentation for this section has not yet been entered.
ParcelFileModeEnumerates values returned by several types and taken as a parameter of the Android.OS.ParcelFileDescriptor.Open, and Android.OS.ParcelFileDescriptor.Open members.
ParcelFormatExceptionThe contents of a Parcel (usually during unmarshalling) does not contain the expected data.
ParcelUuidThis class is a Parcelable wrapper around Java.Util.UUID which is an immutable representation of a 128-bit universally unique identifier.
ParcelUuid+InterfaceConstsDocumentation for this section has not yet been entered.
PatternEnumerates values returned by several types and taken as a parameter of several types.
PatternMatcherA simple pattern matcher, which is safe to use on untrusted data: it does not provide full reg-exp support, only simple globbing that can not be used maliciously.
PatternMatcher+InterfaceConstsDocumentation for this section has not yet been entered.
PersistableBundleA mapping from String values to various types that can be saved to persistent and later restored.
PersistableBundle+InterfaceConstsDocumentation for this section has not yet been entered.
PowerManagerThis class gives you control of the power state of the device.
PowerManager+WakeLockA wake lock is a mechanism to indicate that your application needs to have the device stay on.
ProcessTools for managing OS processes.
RecoverySystemRecoverySystem contains methods for interacting with the Android recovery system (the separate partition that can be used to install system updates, wipe user data, etc.
RecoverySystem+IProgressListenerInterface definition for a callback to be invoked regularly as verification proceeds.
RecoverySystem+ProgressEventArgsDocumentation for this section has not yet been entered.
RemoteCallbackListTakes care of the grunt work of maintaining a list of remote interfaces, typically for the use of performing callbacks from a Android.App.Service to its clients.
RemoteExceptionParent exception for all Binder remote-invocation errors
ResultReceiverGeneric interface for receiving a callback result from someone.
ResultReceiver+InterfaceConstsDocumentation for this section has not yet been entered.
SignalEnumerates values returned by the Android.OS.Signal.Kill, Android.OS.Signal.Quit, and Android.OS.Signal.Usr1 members and taken as a parameter of the Android.OS.Process.SendSignal member.
StatFsRetrieve overall information about the space on a filesystem.
StrictMode
StrictMode+ThreadPolicy Android.OS.StrictMode policy applied to a certain thread.
StrictMode+ThreadPolicy+BuilderCreates Android.OS.StrictMode.ThreadPolicy instances.
StrictMode+VmPolicy Android.OS.StrictMode policy applied to all threads in the virtual machine's process.
StrictMode+VmPolicy+BuilderCreates Android.OS.StrictMode.VmPolicy instances.
SystemClockCore timekeeping facilities.
ThreadPriorityEnumerates values returned by several types and taken as a parameter of the Android.OS.Process.SetThreadPriority, and Android.OS.Process.SetThreadPriority members.
TokenWatcherHelper class that helps you use IBinder objects as reference counted tokens.
TraceWrites trace events to the system trace buffer.
TransactionFlagsEnumerates values returned by several types and taken as a parameter of the Android.OS.Binder.Transact, and Android.OS.IBinder.Transact members.
TransactionTooLargeExceptionThe Binder transaction failed because it was too large.
UserHandleRepresentation of a user on the device.
UserHandle+InterfaceConstsDocumentation for this section has not yet been entered.
UserManagerManages users and user details on a multi-user system.
VibratorClass that operates the vibrator on the device.
WakeLockFlagsEnumerates values returned by several methods of Android.OS.WakeLockFlags and taken as a parameter of the Android.Media.MediaPlayer.SetWakeMode, Android.OS.PowerManager.WakeLock.Release, and Android.OS.PowerManager.NewWakeLock members.
WorkSourceDescribes the source of some work that may be done by someone else.
WorkSource+InterfaceConstsDocumentation for this section has not yet been entered.