@Retention(value=CLASS) @Target(value=METHOD) public @interface OnActivityResult
This annotation is intended to be used on methods to receive results from a
previously started activity using
Activity#startActivityForResult(Intent, int)
or the generated
IntentBuilder.startActivityForResult()
method of the activity.
The annotation value must be an integer constant that represents the requestCode associated with the given result.
The method may have multiple parameter :
Intent
that contains dataint
or an Integer
to get the
resultCodeParcelable
or
Serializable
parameter annotated with
OnActivityResult.Extra
to get an object put in the extras of the intent.Some usage examples of @OnActivityResult annotation:@OnActivityResult(REQUEST_CODE) void onResult(int resultCode, Intent data) { } @OnActivityResult(REQUEST_CODE) void onResult(int resultCode) { } @OnActivityResult(ANOTHER_REQUEST_CODE) void onResult(Intent data) { } @OnActivityResult(ANOTHER_REQUEST_CODE) void onResult(@OnActivityResult.Extra anExtra) { }
EActivity
,
Activity.startActivityForResult(android.content.Intent, int)
,
Activity.onActivityResult(int, int, android.content.Intent)
Modifier and Type | Required Element and Description |
---|---|
int |
value
The requestCode associated with the given result.
|
Copyright © 2010-2015. All Rights Reserved.