OnActivityResult - PerfectCarl/androidannotations GitHub Wiki

Since AndroidAnnotations 2.7

This annotation is intended to be used on methods to receive results from an activity started with [android.app.Activity.startActivityForResult(Intent, int)](http://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent, int))

The annotation value must be an integer constant that represents the requestCode associated with the given result.

The method may have multiple parameters :

  • A android.content.Intent that contains data returned by the previously launched activity
  • An int or a java.lang.Integer to get the resultCode.

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() {
 }