forked from androidannotations/androidannotations
-
Notifications
You must be signed in to change notification settings - Fork 0
OnActivityResult
matboniface edited this page Oct 21, 2012
·
7 revisions
Since AndroidAnnotations 2.7
This annotation is intended to be used on a method to receive results from a previously started activity using android.app.Activity.startActivityForResult(Intent, int)
The annotation value must be a resource id that represents the requestCode associated with the given result. This id can be declared into xml values as follows :
The method may have multiple parameters :
- A
android.content.Intentthat contains data returned by the previously launched activity - An
intor anjava.lang.Integerto get theresultCode.
Some usage examples of @OnActivityResult annotation :
@OnActivityResult(R.id.myRequest)
void onResult(int resultCode, Intent data) {
// Use resultCode and data
}
@OnActivityResult(R.id.myRequest)
void onResult(int resultCode) {
// Only use resultCode
}
@OnActivityResult(R.id.myRequest)
void onResult(Intent data) {
// Only use data
}
@OnActivityResult
void myRequestResult() {
// The method name contains the res id
}
@OnActivityResult(resName = "myRequest")
void anotherResult() {
// Usually for library projects
}AndroidAnnotations was created by Pierre-Yves Ricau and is sponsored by eBusinessInformations.
04/11/2012 The 2.7 release is out
- Get started!
- Download
- Cookbook, full of recipes
- List of all available annotations
- Release Notes
- Examples
- Read the FAQ
- Join the Mailing list
- Create an issue
- Tag on Stack Overflow