PendingIntent | API reference | Android Developers (original) (raw)
public final class PendingIntentextends [Object](/reference/java/lang/Object) implements[Parcelable](/reference/android/os/Parcelable)
A description of an Intent and target action to perform with it. Instances of this class are created with [getActivity(Context, int, Intent, int)](/reference/android/app/PendingIntent#getActivity%28android.content.Context,%20int,%20android.content.Intent,%20int%29), [getActivities(Context, int, Intent, int)](/reference/android/app/PendingIntent#getActivities%28android.content.Context,%20int,%20android.content.Intent[],%20int%29),[getBroadcast(Context, int, Intent, int)](/reference/android/app/PendingIntent#getBroadcast%28android.content.Context,%20int,%20android.content.Intent,%20int%29), and [getService(Context, int, Intent, int)](/reference/android/app/PendingIntent#getService%28android.content.Context,%20int,%20android.content.Intent,%20int%29); the returned object can be handed to other applications so that they can perform the action you described on your behalf at a later time.
By giving a PendingIntent to another application, you are granting it the right to perform the operation you have specified as if the other application was yourself (with the same permissions and identity). As such, you should be careful about how you build the PendingIntent: almost always, for example, the base Intent you supply should have the component name explicitly set to one of your own components, to ensure it is ultimately sent there and nowhere else.
A PendingIntent itself is simply a reference to a token maintained by the system describing the original data used to retrieve it. This means that, even if its owning application's process is killed, the PendingIntent itself will remain usable from other processes that have been given it. If the creating application later re-retrieves the same kind of PendingIntent (same operation, same Intent action, data, categories, and components, and same flags), it will receive a PendingIntent representing the same token if that is still valid, and can thus call[cancel()](/reference/android/app/PendingIntent#cancel%28%29) to remove it.
Because of this behavior, it is important to know when two Intents are considered to be the same for purposes of retrieving a PendingIntent. A common mistake people make is to create multiple PendingIntent objects with Intents that only vary in their "extra" contents, expecting to get a different PendingIntent each time. This does not happen. The parts of the Intent that are used for matching are the same ones defined by [Intent.filterEquals](/reference/android/content/Intent#filterEquals%28android.content.Intent%29). If you use two Intent objects that are equivalent as per[Intent.filterEquals](/reference/android/content/Intent#filterEquals%28android.content.Intent%29), then you will get the same PendingIntent for both of them.
There are two typical ways to deal with this.
If you truly need multiple distinct PendingIntent objects active at the same time (such as to use as two notifications that are both shown at the same time), then you will need to ensure there is something that is different about them to associate them with different PendingIntents. This may be any of the Intent attributes considered by[Intent.filterEquals](/reference/android/content/Intent#filterEquals%28android.content.Intent%29), or different request code integers supplied to [getActivity(Context, int, Intent, int)](/reference/android/app/PendingIntent#getActivity%28android.content.Context,%20int,%20android.content.Intent,%20int%29), [getActivities(Context, int, Intent, int)](/reference/android/app/PendingIntent#getActivities%28android.content.Context,%20int,%20android.content.Intent[],%20int%29),[getBroadcast(Context, int, Intent, int)](/reference/android/app/PendingIntent#getBroadcast%28android.content.Context,%20int,%20android.content.Intent,%20int%29), or [getService(Context, int, Intent, int)](/reference/android/app/PendingIntent#getService%28android.content.Context,%20int,%20android.content.Intent,%20int%29).
If you only need one PendingIntent active at a time for any of the Intents you will use, then you can alternatively use the flags[FLAG_CANCEL_CURRENT](/reference/android/app/PendingIntent#FLAG%5FCANCEL%5FCURRENT) or [FLAG_UPDATE_CURRENT](/reference/android/app/PendingIntent#FLAG%5FUPDATE%5FCURRENT) to either cancel or modify whatever current PendingIntent is associated with the Intent you are supplying.
Also note that flags like [FLAG_ONE_SHOT](/reference/android/app/PendingIntent#FLAG%5FONE%5FSHOT) or [FLAG_IMMUTABLE](/reference/android/app/PendingIntent#FLAG%5FIMMUTABLE) describe the PendingIntent instance and thus, are used to identify it. Any calls to retrieve or modify a PendingIntent created with these flags will also require these flags to be supplied in conjunction with others. E.g. To retrieve an existing PendingIntent created with FLAG_ONE_SHOT, both FLAG_ONE_SHOT and FLAG_NO_CREATE need to be supplied.
Summary
| Nested classes | |
|---|---|
| class | 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. |
| interface | PendingIntent.OnFinished Callback interface for discovering when a send operation has completed. |
| Constants | |
|---|---|
| int | FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT Flag indicating that the created PendingIntent with FLAG_MUTABLE is allowed to have an unsafe implicit Intent within. |
| int | FLAG_CANCEL_CURRENT Flag indicating that if the described PendingIntent already exists, the current one should be canceled before generating a new one. |
| int | FLAG_IMMUTABLE Flag indicating that the created PendingIntent should be immutable. |
| int | FLAG_MUTABLE Flag indicating that the created PendingIntent should be mutable. |
| int | FLAG_NO_CREATE Flag indicating that if the described PendingIntent does not already exist, then simply return null instead of creating it. |
| int | FLAG_ONE_SHOT Flag indicating that this PendingIntent can be used only once. |
| int | FLAG_UPDATE_CURRENT Flag indicating that if the described PendingIntent already exists, then keep it but replace its extra data with what is in this new Intent. |
| Inherited constants |
|---|
| From interfaceandroid.os.Parcelable int CONTENTS_FILE_DESCRIPTOR Descriptor bit used with describeContents(): indicates that the Parcelable object's flattened representation includes a file descriptor. int PARCELABLE_WRITE_RETURN_VALUE Flag for use with writeToParcel(Parcel, int): the object being written is a return value, that is the result of a function such as "Parcelable someFunction()", "void someFunction(out Parcelable)", or "void someFunction(inout Parcelable)". |
| Fields | |
|---|---|
| public static finalCreator<PendingIntent> | CREATOR |
| Public methods | |
|---|---|
| void | cancel() Cancel a currently active PendingIntent. |
| int | describeContents() Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| boolean | equals(Object otherObj) Comparison operator on two PendingIntent objects, such that true is returned then they both represent the same operation from the same package. |
| staticPendingIntent | getActivities(Context context, int requestCode, Intent[] intents, int flags, Bundle options) Like getActivity(android.content.Context, int, android.content.Intent, int), but allows an array of Intents to be supplied. |
| staticPendingIntent | getActivities(Context context, int requestCode, Intent[] intents, int flags) Like getActivity(android.content.Context, int, android.content.Intent, int), but allows an array of Intents to be supplied. |
| staticPendingIntent | getActivity(Context context, int requestCode, Intent intent, int flags) Retrieve a PendingIntent that will start a new activity, like callingContext.startActivity(Intent). |
| staticPendingIntent | getActivity(Context context, int requestCode, Intent intent, int flags, Bundle options) Retrieve a PendingIntent that will start a new activity, like callingContext.startActivity(Intent). |
| staticPendingIntent | getBroadcast(Context context, int requestCode, Intent intent, int flags) Retrieve a PendingIntent that will perform a broadcast, like callingContext.sendBroadcast(). |
| String | getCreatorPackage() Return the package name of the application that created this PendingIntent, that is the identity under which you will actually be sending the Intent. |
| int | getCreatorUid() Return the uid of the application that created this PendingIntent, that is the identity under which you will actually be sending the Intent. |
| UserHandle | getCreatorUserHandle() Return the user handle of the application that created this PendingIntent, that is the user under which you will actually be sending the Intent. |
| staticPendingIntent | getForegroundService(Context context, int requestCode, Intent intent, int flags) Retrieve a PendingIntent that will start a foreground service, like callingContext.startForegroundService(). |
| IntentSender | getIntentSender() Retrieve a IntentSender object that wraps the existing sender of the PendingIntent |
| staticPendingIntent | getService(Context context, int requestCode, Intent intent, int flags) Retrieve a PendingIntent that will start a service, like callingContext.startService(). |
| String | getTargetPackage() This method was deprecated in API level 17. Renamed to getCreatorPackage(). |
| int | hashCode() Returns a hash code value for the object. |
| boolean | isActivity() |
| boolean | isBroadcast() |
| boolean | isForegroundService() |
| boolean | isImmutable() Check if this PendingIntent is marked with FLAG_IMMUTABLE. |
| boolean | isService() |
| staticPendingIntent | readPendingIntentOrNullFromParcel(Parcel in) Convenience function for reading either a PendingIntent or null pointer from a Parcel. |
| void | send(Bundle options) Perform the operation associated with this PendingIntent, supplying additional options for the operation. |
| void | send(Context context, int code, Intent intent, PendingIntent.OnFinished onFinished, Handler handler, String requiredPermission, Bundle options) Perform the operation associated with this PendingIntent, allowing the caller to specify information about the Intent to use and be notified when the send has completed. |
| void | send() Perform the operation associated with this PendingIntent. |
| void | send(Context context, int code, Intent intent, PendingIntent.OnFinished onFinished, Handler handler) Perform the operation associated with this PendingIntent, allowing the caller to specify information about the Intent to use and be notified when the send has completed. |
| void | send(Context context, int code, Intent intent, PendingIntent.OnFinished onFinished, Handler handler, String requiredPermission) Perform the operation associated with this PendingIntent, allowing the caller to specify information about the Intent to use and be notified when the send has completed. |
| void | send(int code, PendingIntent.OnFinished onFinished, Handler handler) Perform the operation associated with this PendingIntent, allowing the caller to be notified when the send has completed. |
| void | send(Context context, int code, Intent intent) Perform the operation associated with this PendingIntent, allowing the caller to specify information about the Intent to use. |
| void | send(int code) Perform the operation associated with this PendingIntent. |
| String | toString() Returns a string representation of the object. |
| static void | writePendingIntentOrNullToParcel(PendingIntent sender, Parcel out) Convenience function for writing either a PendingIntent or null pointer to a Parcel. |
| void | writeToParcel(Parcel out, int flags) Flatten this object in to a Parcel. |
| Inherited methods |
|---|
| From class java.lang.Object Object clone() Creates and returns a copy of this object. boolean equals(Object obj) Indicates whether some other object is "equal to" this one. void finalize() Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. finalClass<?> getClass() Returns the runtime class of this Object. int hashCode() Returns a hash code value for the object. final void notify() Wakes up a single thread that is waiting on this object's monitor. final void notifyAll() Wakes up all threads that are waiting on this object's monitor. String toString() Returns a string representation of the object. final void wait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. final void wait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. final void wait() Causes the current thread to wait until it is awakened, typically by being notified or interrupted. |
| From interface android.os.Parcelable abstract int describeContents() Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. abstract void writeToParcel(Parcel dest, int flags) Flatten this object in to a Parcel. |
Constants
FLAG_CANCEL_CURRENT
public static final int FLAG_CANCEL_CURRENT
Flag indicating that if the described PendingIntent already exists, the current one should be canceled before generating a new one. For use with [getActivity(Context, int, Intent, int)](/reference/android/app/PendingIntent#getActivity%28android.content.Context,%20int,%20android.content.Intent,%20int%29), [getBroadcast(Context, int, Intent, int)](/reference/android/app/PendingIntent#getBroadcast%28android.content.Context,%20int,%20android.content.Intent,%20int%29), and[getService(Context, int, Intent, int)](/reference/android/app/PendingIntent#getService%28android.content.Context,%20int,%20android.content.Intent,%20int%29).
You can use this to retrieve a new PendingIntent when you are only changing the extra data in the Intent; by canceling the previous pending intent, this ensures that only entities given the new data will be able to launch it. If this assurance is not an issue, consider[FLAG_UPDATE_CURRENT](/reference/android/app/PendingIntent#FLAG%5FUPDATE%5FCURRENT).
Constant Value: 268435456 (0x10000000)
FLAG_IMMUTABLE
public static final int FLAG_IMMUTABLE
Flag indicating that the created PendingIntent should be immutable. This means that the additional intent argument passed to the send methods to fill in unpopulated properties of this intent will be ignored.
[FLAG_IMMUTABLE](/reference/android/app/PendingIntent#FLAG%5FIMMUTABLE) only limits the ability to alter the semantics of the intent that is sent by [send()](/reference/android/app/PendingIntent#send%28%29) by the invoker of[send()](/reference/android/app/PendingIntent#send%28%29). The creator of the PendingIntent can always update the PendingIntent itself via [FLAG_UPDATE_CURRENT](/reference/android/app/PendingIntent#FLAG%5FUPDATE%5FCURRENT).
Constant Value: 67108864 (0x04000000)
FLAG_MUTABLE
public static final int FLAG_MUTABLE
Flag indicating that the created PendingIntent should be mutable. This flag cannot be combined with [FLAG_IMMUTABLE](/reference/android/app/PendingIntent#FLAG%5FIMMUTABLE).
Up until[Build.VERSION_CODES.R](/reference/android/os/Build.VERSION%5FCODES#R), PendingIntents are assumed to be mutable by default, unless [FLAG_IMMUTABLE](/reference/android/app/PendingIntent#FLAG%5FIMMUTABLE) is set. Starting with [Build.VERSION_CODES.S](/reference/android/os/Build.VERSION%5FCODES#S), it will be required to explicitly specify the mutability of PendingIntents on creation with either [FLAG_IMMUTABLE](/reference/android/app/PendingIntent#FLAG%5FIMMUTABLE) or [FLAG_MUTABLE](/reference/android/app/PendingIntent#FLAG%5FMUTABLE). It is strongly recommended to use [FLAG_IMMUTABLE](/reference/android/app/PendingIntent#FLAG%5FIMMUTABLE) when creating a PendingIntent. [FLAG_MUTABLE](/reference/android/app/PendingIntent#FLAG%5FMUTABLE) should only be used when some functionality relies on modifying the underlying intent, e.g. any PendingIntent that needs to be used with inline reply or bubbles.
Constant Value: 33554432 (0x02000000)
FLAG_NO_CREATE
public static final int FLAG_NO_CREATE
Flag indicating that if the described PendingIntent does not already exist, then simply return null instead of creating it. For use with [getActivity(Context, int, Intent, int)](/reference/android/app/PendingIntent#getActivity%28android.content.Context,%20int,%20android.content.Intent,%20int%29), [getBroadcast(Context, int, Intent, int)](/reference/android/app/PendingIntent#getBroadcast%28android.content.Context,%20int,%20android.content.Intent,%20int%29), and[getService(Context, int, Intent, int)](/reference/android/app/PendingIntent#getService%28android.content.Context,%20int,%20android.content.Intent,%20int%29).
Constant Value: 536870912 (0x20000000)
FLAG_ONE_SHOT
public static final int FLAG_ONE_SHOT
Flag indicating that this PendingIntent can be used only once. For use with [getActivity(Context, int, Intent, int)](/reference/android/app/PendingIntent#getActivity%28android.content.Context,%20int,%20android.content.Intent,%20int%29), [getBroadcast(Context, int, Intent, int)](/reference/android/app/PendingIntent#getBroadcast%28android.content.Context,%20int,%20android.content.Intent,%20int%29), and[getService(Context, int, Intent, int)](/reference/android/app/PendingIntent#getService%28android.content.Context,%20int,%20android.content.Intent,%20int%29).
If set, after[send()](/reference/android/app/PendingIntent#send%28%29) is called on it, it will be automatically canceled for you and any future attempt to send through it will fail.
Constant Value: 1073741824 (0x40000000)
FLAG_UPDATE_CURRENT
public static final int FLAG_UPDATE_CURRENT
Flag indicating that if the described PendingIntent already exists, then keep it but replace its extra data with what is in this new Intent. For use with [getActivity(Context, int, Intent, int)](/reference/android/app/PendingIntent#getActivity%28android.content.Context,%20int,%20android.content.Intent,%20int%29), [getBroadcast(Context, int, Intent, int)](/reference/android/app/PendingIntent#getBroadcast%28android.content.Context,%20int,%20android.content.Intent,%20int%29), and[getService(Context, int, Intent, int)](/reference/android/app/PendingIntent#getService%28android.content.Context,%20int,%20android.content.Intent,%20int%29).
This can be used if you are creating intents where only the extras change, and don't care that any entities that received your previous PendingIntent will be able to launch it with your new extras even if they are not explicitly given to it.
[FLAG_UPDATE_CURRENT](/reference/android/app/PendingIntent#FLAG%5FUPDATE%5FCURRENT) still works even if [FLAG_IMMUTABLE](/reference/android/app/PendingIntent#FLAG%5FIMMUTABLE) is set - the creator of the PendingIntent can always update the PendingIntent itself. The IMMUTABLE flag only limits the ability to alter the semantics of the intent that is sent by [send()](/reference/android/app/PendingIntent#send%28%29) by the invoker of [send()](/reference/android/app/PendingIntent#send%28%29).
Constant Value: 134217728 (0x08000000)
Fields
Public methods
cancel
public void cancel ()
Cancel a currently active PendingIntent. Only the original application owning a PendingIntent can cancel it.
describeContents
public int describeContents ()
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of [writeToParcel(android.os.Parcel, int)](/reference/android/os/Parcelable#writeToParcel%28android.os.Parcel,%20int%29), the return value of this method must include the[CONTENTS_FILE_DESCRIPTOR](/reference/android/os/Parcelable#CONTENTS%5FFILE%5FDESCRIPTOR) bit.
| Returns | |
|---|---|
| int | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or CONTENTS_FILE_DESCRIPTOR |
equals
public boolean equals (Object otherObj)
Comparison operator on two PendingIntent objects, such that true is returned then they both represent the same operation from the same package. This allows you to use [getActivity(Context, int, Intent, int)](/reference/android/app/PendingIntent#getActivity%28android.content.Context,%20int,%20android.content.Intent,%20int%29),[getBroadcast(Context, int, Intent, int)](/reference/android/app/PendingIntent#getBroadcast%28android.content.Context,%20int,%20android.content.Intent,%20int%29), or [getService(Context, int, Intent, int)](/reference/android/app/PendingIntent#getService%28android.content.Context,%20int,%20android.content.Intent,%20int%29) multiple times (even across a process being killed), resulting in different PendingIntent objects but whose equals() method identifies them as being the same operation.
| Parameters | |
|---|---|
| otherObj | Object: This value may be null. |
| Returns | |
|---|---|
| boolean | true if this object is the same as the obj argument; false otherwise. |
getActivities
public static PendingIntent getActivities (Context context, int requestCode, Intent[] intents, int flags, Bundle options)
Like [getActivity(android.content.Context, int, android.content.Intent, int)](/reference/android/app/PendingIntent#getActivity%28android.content.Context,%20int,%20android.content.Intent,%20int%29), but allows an array of Intents to be supplied. The last Intent in the array is taken as the primary key for the PendingIntent, like the single Intent given to [getActivity(android.content.Context, int, android.content.Intent, int)](/reference/android/app/PendingIntent#getActivity%28android.content.Context,%20int,%20android.content.Intent,%20int%29). Upon sending the resulting PendingIntent, all of the Intents are started in the same way as they would be by passing them to [Context.startActivities(Intent[])](/reference/android/content/Context#startActivities%28android.content.Intent[]%29).
The first intent in the array will be started outside of the context of an existing activity, so you must use the [Intent.FLAG_ACTIVITY_NEW_TASK](/reference/android/content/Intent#FLAG%5FACTIVITY%5FNEW%5FTASK) launch flag in the Intent. (Activities after the first in the array are started in the context of the previous activity in the array, so FLAG_ACTIVITY_NEW_TASK is not needed nor desired for them.)
The last intent in the array represents the key for the PendingIntent. In other words, it is the significant element for matching (as done with the single intent given to [getActivity(android.content.Context, int, android.content.Intent, int)](/reference/android/app/PendingIntent#getActivity%28android.content.Context,%20int,%20android.content.Intent,%20int%29), its content will be the subject of replacement by[send(android.content.Context, int, android.content.Intent)](/reference/android/app/PendingIntent#send%28android.content.Context,%20int,%20android.content.Intent%29) and [FLAG_UPDATE_CURRENT](/reference/android/app/PendingIntent#FLAG%5FUPDATE%5FCURRENT), etc. This is because it is the most specific of the supplied intents, and the UI the user actually sees when the intents are started.
For security reasons, the [Intent](/reference/android/content/Intent) objects you supply here should almost always be explicit intents, that is specify an explicit component to be delivered to through[Intent.setClass](/reference/android/content/Intent#setClass%28android.content.Context,%20java.lang.Class<?>%29)
| Parameters | |
|---|---|
| context | Context: The Context in which this PendingIntent should start the activity. |
| requestCode | int: Private request code for the sender |
| intents | Intent: Array of Intents of the activities to be launched. This value cannot be null. |
| flags | int: May be FLAG_ONE_SHOT, FLAG_NO_CREATE,FLAG_CANCEL_CURRENT, FLAG_UPDATE_CURRENT,FLAG_IMMUTABLE or any of the flags as supported byIntent.fillIn() to control which unspecified parts of the intent that can be supplied when the actual send happens. Value is either 0 or a combination of FLAG_ONE_SHOT, FLAG_NO_CREATE, FLAG_CANCEL_CURRENT, FLAG_UPDATE_CURRENT, FLAG_IMMUTABLE, FLAG_MUTABLE, android.app.PendingIntent.FLAG_MUTABLE_UNAUDITED, FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT, Intent.FILL_IN_ACTION, Intent.FILL_IN_DATA, Intent.FILL_IN_CATEGORIES, Intent.FILL_IN_COMPONENT, Intent.FILL_IN_PACKAGE, Intent.FILL_IN_SOURCE_BOUNDS, Intent.FILL_IN_SELECTOR, and Intent.FILL_IN_CLIP_DATA |
| options | Bundle: This value may be null. |
| Returns | |
|---|---|
| PendingIntent | Returns an existing or new PendingIntent matching the given parameters. May return null only if FLAG_NO_CREATE has been supplied. |
getActivities
public static PendingIntent getActivities (Context context, int requestCode, Intent[] intents, int flags)
Like [getActivity(android.content.Context, int, android.content.Intent, int)](/reference/android/app/PendingIntent#getActivity%28android.content.Context,%20int,%20android.content.Intent,%20int%29), but allows an array of Intents to be supplied. The last Intent in the array is taken as the primary key for the PendingIntent, like the single Intent given to [getActivity(android.content.Context, int, android.content.Intent, int)](/reference/android/app/PendingIntent#getActivity%28android.content.Context,%20int,%20android.content.Intent,%20int%29). Upon sending the resulting PendingIntent, all of the Intents are started in the same way as they would be by passing them to [Context.startActivities(Intent[])](/reference/android/content/Context#startActivities%28android.content.Intent[]%29).
The first intent in the array will be started outside of the context of an existing activity, so you must use the [Intent.FLAG_ACTIVITY_NEW_TASK](/reference/android/content/Intent#FLAG%5FACTIVITY%5FNEW%5FTASK) launch flag in the Intent. (Activities after the first in the array are started in the context of the previous activity in the array, so FLAG_ACTIVITY_NEW_TASK is not needed nor desired for them.)
The last intent in the array represents the key for the PendingIntent. In other words, it is the significant element for matching (as done with the single intent given to [getActivity(android.content.Context, int, android.content.Intent, int)](/reference/android/app/PendingIntent#getActivity%28android.content.Context,%20int,%20android.content.Intent,%20int%29), its content will be the subject of replacement by[send(android.content.Context, int, android.content.Intent)](/reference/android/app/PendingIntent#send%28android.content.Context,%20int,%20android.content.Intent%29) and [FLAG_UPDATE_CURRENT](/reference/android/app/PendingIntent#FLAG%5FUPDATE%5FCURRENT), etc. This is because it is the most specific of the supplied intents, and the UI the user actually sees when the intents are started.
For security reasons, the [Intent](/reference/android/content/Intent) objects you supply here should almost always be explicit intents, that is specify an explicit component to be delivered to through[Intent.setClass](/reference/android/content/Intent#setClass%28android.content.Context,%20java.lang.Class<?>%29)
| Parameters | |
|---|---|
| context | Context: The Context in which this PendingIntent should start the activity. |
| requestCode | int: Private request code for the sender |
| intents | Intent: Array of Intents of the activities to be launched. This value cannot be null. |
| flags | int: May be FLAG_ONE_SHOT, FLAG_NO_CREATE,FLAG_CANCEL_CURRENT, FLAG_UPDATE_CURRENT, or any of the flags as supported byIntent.fillIn() to control which unspecified parts of the intent that can be supplied when the actual send happens. Value is either 0 or a combination of FLAG_ONE_SHOT, FLAG_NO_CREATE, FLAG_CANCEL_CURRENT, FLAG_UPDATE_CURRENT, FLAG_IMMUTABLE, FLAG_MUTABLE, android.app.PendingIntent.FLAG_MUTABLE_UNAUDITED, FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT, Intent.FILL_IN_ACTION, Intent.FILL_IN_DATA, Intent.FILL_IN_CATEGORIES, Intent.FILL_IN_COMPONENT, Intent.FILL_IN_PACKAGE, Intent.FILL_IN_SOURCE_BOUNDS, Intent.FILL_IN_SELECTOR, and Intent.FILL_IN_CLIP_DATA |
| Returns | |
|---|---|
| PendingIntent | Returns an existing or new PendingIntent matching the given parameters. May return null only if FLAG_NO_CREATE has been supplied. |
getActivity
public static PendingIntent getActivity (Context context, int requestCode, Intent intent, int flags)
Retrieve a PendingIntent that will start a new activity, like calling[Context.startActivity(Intent)](/reference/android/content/Context#startActivity%28android.content.Intent%29). Note that the activity will be started outside of the context of an existing activity, so you must use the [Intent.FLAG_ACTIVITY_NEW_TASK](/reference/android/content/Intent#FLAG%5FACTIVITY%5FNEW%5FTASK) launch flag in the Intent.
For security reasons, the [Intent](/reference/android/content/Intent) you supply here should almost always be an explicit intent, that is specify an explicit component to be delivered to through[Intent.setClass](/reference/android/content/Intent#setClass%28android.content.Context,%20java.lang.Class<?>%29)
| Parameters | |
|---|---|
| context | Context: The Context in which this PendingIntent should start the activity. |
| requestCode | int: Private request code for the sender |
| intent | Intent: Intent of the activity to be launched. |
| flags | int: May be FLAG_ONE_SHOT, FLAG_NO_CREATE,FLAG_CANCEL_CURRENT, FLAG_UPDATE_CURRENT, or any of the flags as supported byIntent.fillIn() to control which unspecified parts of the intent that can be supplied when the actual send happens. Value is either 0 or a combination of FLAG_ONE_SHOT, FLAG_NO_CREATE, FLAG_CANCEL_CURRENT, FLAG_UPDATE_CURRENT, FLAG_IMMUTABLE, FLAG_MUTABLE, android.app.PendingIntent.FLAG_MUTABLE_UNAUDITED, FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT, Intent.FILL_IN_ACTION, Intent.FILL_IN_DATA, Intent.FILL_IN_CATEGORIES, Intent.FILL_IN_COMPONENT, Intent.FILL_IN_PACKAGE, Intent.FILL_IN_SOURCE_BOUNDS, Intent.FILL_IN_SELECTOR, and Intent.FILL_IN_CLIP_DATA |
| Returns | |
|---|---|
| PendingIntent | Returns an existing or new PendingIntent matching the given parameters. May return null only if FLAG_NO_CREATE has been supplied. |
getActivity
public static PendingIntent getActivity (Context context, int requestCode, Intent intent, int flags, Bundle options)
Retrieve a PendingIntent that will start a new activity, like calling[Context.startActivity(Intent)](/reference/android/content/Context#startActivity%28android.content.Intent%29). Note that the activity will be started outside of the context of an existing activity, so you must use the [Intent.FLAG_ACTIVITY_NEW_TASK](/reference/android/content/Intent#FLAG%5FACTIVITY%5FNEW%5FTASK) launch flag in the Intent.
For security reasons, the [Intent](/reference/android/content/Intent) you supply here should almost always be an explicit intent, that is specify an explicit component to be delivered to through[Intent.setClass](/reference/android/content/Intent#setClass%28android.content.Context,%20java.lang.Class<?>%29)
| Parameters | |
|---|---|
| context | Context: The Context in which this PendingIntent should start the activity. |
| requestCode | int: Private request code for the sender |
| intent | Intent: Intent of the activity to be launched. This value cannot be null. |
| flags | int: May be FLAG_ONE_SHOT, FLAG_NO_CREATE,FLAG_CANCEL_CURRENT, FLAG_UPDATE_CURRENT, or any of the flags as supported byIntent.fillIn() to control which unspecified parts of the intent that can be supplied when the actual send happens. Value is either 0 or a combination of FLAG_ONE_SHOT, FLAG_NO_CREATE, FLAG_CANCEL_CURRENT, FLAG_UPDATE_CURRENT, FLAG_IMMUTABLE, FLAG_MUTABLE, android.app.PendingIntent.FLAG_MUTABLE_UNAUDITED, FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT, Intent.FILL_IN_ACTION, Intent.FILL_IN_DATA, Intent.FILL_IN_CATEGORIES, Intent.FILL_IN_COMPONENT, Intent.FILL_IN_PACKAGE, Intent.FILL_IN_SOURCE_BOUNDS, Intent.FILL_IN_SELECTOR, and Intent.FILL_IN_CLIP_DATA |
| options | Bundle: Additional options for how the Activity should be started. May be null if there are no options. |
| Returns | |
|---|---|
| PendingIntent | Returns an existing or new PendingIntent matching the given parameters. May return null only if FLAG_NO_CREATE has been supplied. |
getBroadcast
public static PendingIntent getBroadcast (Context context, int requestCode, Intent intent, int flags)
Retrieve a PendingIntent that will perform a broadcast, like calling[Context.sendBroadcast()](/reference/android/content/Context#sendBroadcast%28android.content.Intent%29).
For security reasons, the [Intent](/reference/android/content/Intent) you supply here should almost always be an explicit intent, that is specify an explicit component to be delivered to through[Intent.setClass](/reference/android/content/Intent#setClass%28android.content.Context,%20java.lang.Class<?>%29)
| Parameters | |
|---|---|
| context | Context: The Context in which this PendingIntent should perform the broadcast. |
| requestCode | int: Private request code for the sender |
| intent | Intent: The Intent to be broadcast. This value cannot be null. |
| flags | int: May be FLAG_ONE_SHOT, FLAG_NO_CREATE,FLAG_CANCEL_CURRENT, FLAG_UPDATE_CURRENT,FLAG_IMMUTABLE or any of the flags as supported byIntent.fillIn() to control which unspecified parts of the intent that can be supplied when the actual send happens. Value is either 0 or a combination of FLAG_ONE_SHOT, FLAG_NO_CREATE, FLAG_CANCEL_CURRENT, FLAG_UPDATE_CURRENT, FLAG_IMMUTABLE, FLAG_MUTABLE, android.app.PendingIntent.FLAG_MUTABLE_UNAUDITED, FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT, Intent.FILL_IN_ACTION, Intent.FILL_IN_DATA, Intent.FILL_IN_CATEGORIES, Intent.FILL_IN_COMPONENT, Intent.FILL_IN_PACKAGE, Intent.FILL_IN_SOURCE_BOUNDS, Intent.FILL_IN_SELECTOR, and Intent.FILL_IN_CLIP_DATA |
| Returns | |
|---|---|
| PendingIntent | Returns an existing or new PendingIntent matching the given parameters. May return null only if FLAG_NO_CREATE has been supplied. |
getCreatorPackage
public String getCreatorPackage ()
Return the package name of the application that created this PendingIntent, that is the identity under which you will actually be sending the Intent. The returned string is supplied by the system, so that an application can not spoof its package.
Be careful about how you use this. All this tells you is who created the PendingIntent. It does not tell you who handed the PendingIntent to you: that is, PendingIntent objects are intended to be passed between applications, so the PendingIntent you receive from an application could actually be one it received from another application, meaning the result you get here will identify the original application. Because of this, you should only use this information to identify who you expect to be interacting with through a [send()](/reference/android/app/PendingIntent#send%28%29) call, not who gave you the PendingIntent.
| Returns | |
|---|---|
| String | The package name of the PendingIntent. This value may be null. |
getCreatorUid
public int getCreatorUid ()
Return the uid of the application that created this PendingIntent, that is the identity under which you will actually be sending the Intent. The returned integer is supplied by the system, so that an application can not spoof its uid.
Be careful about how you use this. All this tells you is who created the PendingIntent. It does not tell you who handed the PendingIntent to you: that is, PendingIntent objects are intended to be passed between applications, so the PendingIntent you receive from an application could actually be one it received from another application, meaning the result you get here will identify the original application. Because of this, you should only use this information to identify who you expect to be interacting with through a [send()](/reference/android/app/PendingIntent#send%28%29) call, not who gave you the PendingIntent.
| Returns | |
|---|---|
| int | The uid of the PendingIntent, or -1 if there is none associated with it. |
getCreatorUserHandle
public UserHandle getCreatorUserHandle ()
Return the user handle of the application that created this PendingIntent, that is the user under which you will actually be sending the Intent. The returned UserHandle is supplied by the system, so that an application can not spoof its user. See[Process.myUserHandle()](/reference/android/os/Process#myUserHandle%28%29) for more explanation of user handles.
Be careful about how you use this. All this tells you is who created the PendingIntent. It does not tell you who handed the PendingIntent to you: that is, PendingIntent objects are intended to be passed between applications, so the PendingIntent you receive from an application could actually be one it received from another application, meaning the result you get here will identify the original application. Because of this, you should only use this information to identify who you expect to be interacting with through a [send()](/reference/android/app/PendingIntent#send%28%29) call, not who gave you the PendingIntent.
| Returns | |
|---|---|
| UserHandle | The user handle of the PendingIntent This value cannot be null. |
getForegroundService
public static PendingIntent getForegroundService (Context context, int requestCode, Intent intent, int flags)
Retrieve a PendingIntent that will start a foreground service, like calling[Context.startForegroundService()](/reference/android/content/Context#startForegroundService%28android.content.Intent%29). The start arguments given to the service will come from the extras of the Intent.
For security reasons, the [Intent](/reference/android/content/Intent) you supply here should almost always be an explicit intent, that is specify an explicit component to be delivered to through[Intent.setClass](/reference/android/content/Intent#setClass%28android.content.Context,%20java.lang.Class<?>%29)
| Parameters | |
|---|---|
| context | Context: The Context in which this PendingIntent should start the service. |
| requestCode | int: Private request code for the sender |
| intent | Intent: An Intent describing the service to be started. This value cannot be null. |
| flags | int: May be FLAG_ONE_SHOT, FLAG_NO_CREATE,FLAG_CANCEL_CURRENT, FLAG_UPDATE_CURRENT,FLAG_IMMUTABLE or any of the flags as supported byIntent.fillIn() to control which unspecified parts of the intent that can be supplied when the actual send happens. Value is either 0 or a combination of FLAG_ONE_SHOT, FLAG_NO_CREATE, FLAG_CANCEL_CURRENT, FLAG_UPDATE_CURRENT, FLAG_IMMUTABLE, FLAG_MUTABLE, android.app.PendingIntent.FLAG_MUTABLE_UNAUDITED, FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT, Intent.FILL_IN_ACTION, Intent.FILL_IN_DATA, Intent.FILL_IN_CATEGORIES, Intent.FILL_IN_COMPONENT, Intent.FILL_IN_PACKAGE, Intent.FILL_IN_SOURCE_BOUNDS, Intent.FILL_IN_SELECTOR, and Intent.FILL_IN_CLIP_DATA |
| Returns | |
|---|---|
| PendingIntent | Returns an existing or new PendingIntent matching the given parameters. May return null only if FLAG_NO_CREATE has been supplied. |
getIntentSender
public IntentSender getIntentSender ()
Retrieve a IntentSender object that wraps the existing sender of the PendingIntent
| Returns | |
|---|---|
| IntentSender | Returns a IntentSender object that wraps the sender of PendingIntent This value cannot be null. |
getService
public static PendingIntent getService (Context context, int requestCode, Intent intent, int flags)
Retrieve a PendingIntent that will start a service, like calling[Context.startService()](/reference/android/content/Context#startService%28android.content.Intent%29). The start arguments given to the service will come from the extras of the Intent.
For security reasons, the [Intent](/reference/android/content/Intent) you supply here should almost always be an explicit intent, that is specify an explicit component to be delivered to through[Intent.setClass](/reference/android/content/Intent#setClass%28android.content.Context,%20java.lang.Class<?>%29)
| Parameters | |
|---|---|
| context | Context: The Context in which this PendingIntent should start the service. |
| requestCode | int: Private request code for the sender |
| intent | Intent: An Intent describing the service to be started. This value cannot be null. |
| flags | int: May be FLAG_ONE_SHOT, FLAG_NO_CREATE,FLAG_CANCEL_CURRENT, FLAG_UPDATE_CURRENT,FLAG_IMMUTABLE or any of the flags as supported byIntent.fillIn() to control which unspecified parts of the intent that can be supplied when the actual send happens. Value is either 0 or a combination of FLAG_ONE_SHOT, FLAG_NO_CREATE, FLAG_CANCEL_CURRENT, FLAG_UPDATE_CURRENT, FLAG_IMMUTABLE, FLAG_MUTABLE, android.app.PendingIntent.FLAG_MUTABLE_UNAUDITED, FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT, Intent.FILL_IN_ACTION, Intent.FILL_IN_DATA, Intent.FILL_IN_CATEGORIES, Intent.FILL_IN_COMPONENT, Intent.FILL_IN_PACKAGE, Intent.FILL_IN_SOURCE_BOUNDS, Intent.FILL_IN_SELECTOR, and Intent.FILL_IN_CLIP_DATA |
| Returns | |
|---|---|
| PendingIntent | Returns an existing or new PendingIntent matching the given parameters. May return null only if FLAG_NO_CREATE has been supplied. |
getTargetPackage
public String getTargetPackage ()
This method was deprecated in API level 17.
Renamed to [getCreatorPackage()](/reference/android/app/PendingIntent#getCreatorPackage%28%29).
| Returns | |
|---|---|
| String | This value may be null. |
hashCode
public int hashCode ()
Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by[HashMap](/reference/java/util/HashMap).
The general contract of hashCode is:
- Whenever it is invoked on the same object more than once during an execution of a Java application, the
hashCodemethod must consistently return the same integer, provided no information used inequalscomparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application. - If two objects are equal according to the
[equals](/reference/java/lang/Object#equals%28java.lang.Object%29)method, then calling thehashCodemethod on each of the two objects must produce the same integer result. - It is not required that if two objects are unequal according to the
[equals](/reference/java/lang/Object#equals%28java.lang.Object%29)method, then calling thehashCodemethod on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
| Returns | |
|---|---|
| int | a hash code value for this object. |
isImmutable
public boolean isImmutable ()
Check if this PendingIntent is marked with [FLAG_IMMUTABLE](/reference/android/app/PendingIntent#FLAG%5FIMMUTABLE).
| Returns |
|---|
| boolean |
readPendingIntentOrNullFromParcel
public static PendingIntent readPendingIntentOrNullFromParcel (Parcel in)
Convenience function for reading either a PendingIntent or null pointer from a Parcel. You must have previously written the PendingIntent with[writePendingIntentOrNullToParcel(PendingIntent, Parcel)](/reference/android/app/PendingIntent#writePendingIntentOrNullToParcel%28android.app.PendingIntent,%20android.os.Parcel%29).
| Parameters | |
|---|---|
| in | Parcel: The Parcel containing the written PendingIntent. This value cannot be null. |
| Returns | |
|---|---|
| PendingIntent | Returns the PendingIntent read from the Parcel, or null if null had been written. |
send
public void send (Bundle options)
Perform the operation associated with this PendingIntent, supplying additional options for the operation.
| Parameters | |
|---|---|
| options | Bundle: Additional options the caller would like to provide to modify the sending behavior. May be built from an ActivityOptions to apply to an activity start. This value may be null. |
| Throws | |
|---|---|
| PendingIntent.CanceledException | Throws CanceledException if the PendingIntent is no longer allowing more intents to be sent through it. |
send
public void send (Context context, int code, Intent intent, PendingIntent.OnFinished onFinished, Handler handler, String requiredPermission, Bundle options)
Perform the operation associated with this PendingIntent, allowing the caller to specify information about the Intent to use and be notified when the send has completed.
For the intent parameter, a PendingIntent often has restrictions on which fields can be supplied here, based on how the PendingIntent was retrieved in [getActivity(Context, int, Intent, int)](/reference/android/app/PendingIntent#getActivity%28android.content.Context,%20int,%20android.content.Intent,%20int%29),[getBroadcast(Context, int, Intent, int)](/reference/android/app/PendingIntent#getBroadcast%28android.content.Context,%20int,%20android.content.Intent,%20int%29), or [getService(Context, int, Intent, int)](/reference/android/app/PendingIntent#getService%28android.content.Context,%20int,%20android.content.Intent,%20int%29).
| Parameters | |
|---|---|
| context | Context: The Context of the caller. This may be null ifintent is also null. |
| code | int: Result code to supply back to the PendingIntent's target. |
| intent | Intent: Additional Intent data. See Intent.fillIn() for information on how this is applied to the original Intent. Use null to not modify the original Intent. If flag FLAG_IMMUTABLE was set when this pending intent was created, this argument will be ignored. |
| onFinished | PendingIntent.OnFinished: The object to call back on when the send has completed, or null for no callback. |
| handler | Handler: Handler identifying the thread on which the callback should happen. If null, the callback will happen from the thread pool of the process. |
| requiredPermission | String: Name of permission that a recipient of the PendingIntent is required to hold. This is only valid for broadcast intents, and corresponds to the permission argument inContext.sendOrderedBroadcast(Intent, String). If null, no permission is required. |
| options | Bundle: Additional options the caller would like to provide to modify the sending behavior. May be built from an ActivityOptions to apply to an activity start. This value may be null. |
| Throws | |
|---|---|
| PendingIntent.CanceledException | Throws CanceledException if the PendingIntent is no longer allowing more intents to be sent through it. |
send
public void send ()
Perform the operation associated with this PendingIntent.
| Throws | |
|---|---|
| PendingIntent.CanceledException | Throws CanceledException if the PendingIntent is no longer allowing more intents to be sent through it. |
send
public void send (Context context, int code, Intent intent, PendingIntent.OnFinished onFinished, Handler handler)
Perform the operation associated with this PendingIntent, allowing the caller to specify information about the Intent to use and be notified when the send has completed.
For the intent parameter, a PendingIntent often has restrictions on which fields can be supplied here, based on how the PendingIntent was retrieved in [getActivity(Context, int, Intent, int)](/reference/android/app/PendingIntent#getActivity%28android.content.Context,%20int,%20android.content.Intent,%20int%29),[getBroadcast(Context, int, Intent, int)](/reference/android/app/PendingIntent#getBroadcast%28android.content.Context,%20int,%20android.content.Intent,%20int%29), or [getService(Context, int, Intent, int)](/reference/android/app/PendingIntent#getService%28android.content.Context,%20int,%20android.content.Intent,%20int%29).
| Parameters | |
|---|---|
| context | Context: The Context of the caller. This may be null ifintent is also null. |
| code | int: Result code to supply back to the PendingIntent's target. |
| intent | Intent: Additional Intent data. See Intent.fillIn() for information on how this is applied to the original Intent. Use null to not modify the original Intent. If flag FLAG_IMMUTABLE was set when this pending intent was created, this argument will be ignored. |
| onFinished | PendingIntent.OnFinished: The object to call back on when the send has completed, or null for no callback. |
| handler | Handler: Handler identifying the thread on which the callback should happen. If null, the callback will happen from the thread pool of the process. |
| Throws | |
|---|---|
| PendingIntent.CanceledException | Throws CanceledException if the PendingIntent is no longer allowing more intents to be sent through it. |
send
public void send (Context context, int code, Intent intent, PendingIntent.OnFinished onFinished, Handler handler, String requiredPermission)
Perform the operation associated with this PendingIntent, allowing the caller to specify information about the Intent to use and be notified when the send has completed.
For the intent parameter, a PendingIntent often has restrictions on which fields can be supplied here, based on how the PendingIntent was retrieved in [getActivity(Context, int, Intent, int)](/reference/android/app/PendingIntent#getActivity%28android.content.Context,%20int,%20android.content.Intent,%20int%29),[getBroadcast(Context, int, Intent, int)](/reference/android/app/PendingIntent#getBroadcast%28android.content.Context,%20int,%20android.content.Intent,%20int%29), or [getService(Context, int, Intent, int)](/reference/android/app/PendingIntent#getService%28android.content.Context,%20int,%20android.content.Intent,%20int%29).
| Parameters | |
|---|---|
| context | Context: The Context of the caller. This may be null ifintent is also null. |
| code | int: Result code to supply back to the PendingIntent's target. |
| intent | Intent: Additional Intent data. See Intent.fillIn() for information on how this is applied to the original Intent. Use null to not modify the original Intent. If flag FLAG_IMMUTABLE was set when this pending intent was created, this argument will be ignored. |
| onFinished | PendingIntent.OnFinished: The object to call back on when the send has completed, or null for no callback. |
| handler | Handler: Handler identifying the thread on which the callback should happen. If null, the callback will happen from the thread pool of the process. |
| requiredPermission | String: Name of permission that a recipient of the PendingIntent is required to hold. This is only valid for broadcast intents, and corresponds to the permission argument inContext.sendOrderedBroadcast(Intent, String). If null, no permission is required. |
| Throws | |
|---|---|
| PendingIntent.CanceledException | Throws CanceledException if the PendingIntent is no longer allowing more intents to be sent through it. |
send
public void send (int code, PendingIntent.OnFinished onFinished, Handler handler)
Perform the operation associated with this PendingIntent, allowing the caller to be notified when the send has completed.
| Parameters | |
|---|---|
| code | int: Result code to supply back to the PendingIntent's target. |
| onFinished | PendingIntent.OnFinished: The object to call back on when the send has completed, or null for no callback. |
| handler | Handler: Handler identifying the thread on which the callback should happen. If null, the callback will happen from the thread pool of the process. |
| Throws | |
|---|---|
| PendingIntent.CanceledException | Throws CanceledException if the PendingIntent is no longer allowing more intents to be sent through it. |
send
public void send (Context context, int code, Intent intent)
Perform the operation associated with this PendingIntent, allowing the caller to specify information about the Intent to use.
| Parameters | |
|---|---|
| context | Context: The Context of the caller. |
| code | int: Result code to supply back to the PendingIntent's target. |
| intent | Intent: Additional Intent data. See Intent.fillIn() for information on how this is applied to the original Intent. If flag FLAG_IMMUTABLE was set when this pending intent was created, this argument will be ignored. This value may be null. |
| Throws | |
|---|---|
| PendingIntent.CanceledException | Throws CanceledException if the PendingIntent is no longer allowing more intents to be sent through it. |
send
public void send (int code)
Perform the operation associated with this PendingIntent.
| Parameters | |
|---|---|
| code | int: Result code to supply back to the PendingIntent's target. |
| Throws | |
|---|---|
| PendingIntent.CanceledException | Throws CanceledException if the PendingIntent is no longer allowing more intents to be sent through it. |
toString
public String toString ()
Returns a string representation of the object.
| Returns | |
|---|---|
| String | a string representation of the object. |
writePendingIntentOrNullToParcel
public static void writePendingIntentOrNullToParcel (PendingIntent sender, Parcel out)
Convenience function for writing either a PendingIntent or null pointer to a Parcel. You must use this with [readPendingIntentOrNullFromParcel(Parcel)](/reference/android/app/PendingIntent#readPendingIntentOrNullFromParcel%28android.os.Parcel%29) for later reading it.
| Parameters | |
|---|---|
| sender | PendingIntent: The PendingIntent to write, or null. |
| out | Parcel: Where to write the PendingIntent. This value cannot be null. |
writeToParcel
public void writeToParcel (Parcel out, int flags)
Flatten this object in to a Parcel.
| Parameters | |
|---|---|
| out | Parcel: The Parcel in which the object should be written. This value cannot be null. |
| flags | int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |