java.lang.Object | |
↳ | android.os.Messenger |
Reference to a Handler, which others can use to send messages to it. This allows for the implementation of message-based communication across processes, by creating a Messenger pointing to a Handler in one process, and handing that Messenger to another process.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
android.os.Parcelable
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CREATOR |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a new Messenger pointing to the given Handler.
| |||||||||||
Create a Messenger from a raw IBinder, which had previously been
retrieved with
getBinder() . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Describe the kinds of special objects contained in this Parcelable's
marshalled representation.
| |||||||||||
Comparison operator on two Messenger objects, such that true
is returned then they both point to the same Handler.
| |||||||||||
Retrieve the IBinder that this Messenger is using to communicate with
its associated Handler.
| |||||||||||
Returns an integer hash code for this object.
| |||||||||||
Convenience function for reading either a Messenger or null pointer from
a Parcel.
| |||||||||||
Send a Message to this Messenger's Handler.
| |||||||||||
Convenience function for writing either a Messenger or null pointer to
a Parcel.
| |||||||||||
Flatten this object in to a Parcel.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
android.os.Parcelable
|
Create a new Messenger pointing to the given Handler. Any Message
objects sent through this Messenger will appear in the Handler as if
Handler.sendMessage(Message)
had
been called directly.
target | The Handler that will receive sent messages. |
---|
Create a Messenger from a raw IBinder, which had previously been
retrieved with getBinder()
.
target | The IBinder this Messenger should communicate with. |
---|
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
Comparison operator on two Messenger objects, such that true is returned then they both point to the same Handler.
otherObj | the object to compare this instance with. |
---|
true
if the specified object is equal to this Object
; false
otherwise.Retrieve the IBinder that this Messenger is using to communicate with its associated Handler.
Returns an integer hash code for this object. By contract, any two
objects for which equals(Object)
returns true
must return
the same hash code value. This means that subclasses of Object
usually override both methods or neither method.
Note that hash values must not change over time unless information used in equals comparisons also changes.
See Writing a correct
hashCode
method
if you intend implementing your own hashCode
method.
Convenience function for reading either a Messenger or null pointer from
a Parcel. You must have previously written the Messenger with
writeMessengerOrNullToParcel(Messenger, Parcel)
.
in | The Parcel containing the written Messenger. |
---|
Send a Message to this Messenger's Handler.
message | The Message to send. Usually retrieved through
Message.obtain() . |
---|
RemoteException | Throws DeadObjectException if the target Handler no longer exists. |
---|
Convenience function for writing either a Messenger or null pointer to
a Parcel. You must use this with readMessengerOrNullFromParcel(Parcel)
for later reading it.
messenger | The Messenger to write, or null. |
---|---|
out | Where to write the Messenger. |
Flatten this object in to a Parcel.
out | The Parcel in which the object should be written. |
---|---|
flags | Additional flags about how the object should be written.
May be 0 or PARCELABLE_WRITE_RETURN_VALUE .
|