public class ResultReceiver extends Object implements Parcelable
onReceiveResult(int, android.os.Bundle)
, which you can
then pass to others and send through IPC, and receive results they
supply with send(int, android.os.Bundle)
.Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<ResultReceiver> |
CREATOR |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description |
---|
ResultReceiver(Handler handler)
Create a new ResultReceive to receive results.
|
Modifier and Type | Method and Description |
---|---|
int |
describeContents()
Describe the kinds of special objects contained in this Parcelable's
marshalled representation.
|
protected void |
onReceiveResult(int resultCode,
Bundle resultData)
Override to receive results delivered to this object.
|
void |
send(int resultCode,
Bundle resultData)
Deliver a result to this receiver.
|
void |
writeToParcel(Parcel out,
int flags)
Flatten this object in to a Parcel.
|
public static final Parcelable.Creator<ResultReceiver> CREATOR
public ResultReceiver(Handler handler)
onReceiveResult(int, android.os.Bundle)
method will be called from the thread running
handler if given, or from an arbitrary thread if null.public void send(int resultCode, Bundle resultData)
onReceiveResult(int, android.os.Bundle)
,
always asynchronously if the receiver has supplied a Handler in which
to dispatch the result.resultCode
- Arbitrary result code to deliver, as defined by you.resultData
- Any additional data provided by you.protected void onReceiveResult(int resultCode, Bundle resultData)
resultCode
- Arbitrary result code delivered by the sender, as
defined by the sender.resultData
- Any additional data provided by the sender.public int describeContents()
Parcelable
describeContents
in interface Parcelable
public void writeToParcel(Parcel out, int flags)
Parcelable
writeToParcel
in interface Parcelable
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.PARCELABLE_WRITE_RETURN_VALUE
.