All Downloads are FREE. Search and download functionalities are using the official Maven repository.

onactivityresult.OnActivityResult Maven / Gradle / Ivy

There is a newer version: 0.6.0
Show newest version
package onactivityresult;

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.CLASS;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

/**
 * non private and non static methods can be annotated with {@link OnActivityResult}
 * Example:
*

* * @OnActivityResult(requestCode = 1) * void onResult(final int resultCode, final Intent intent) { * // Do something * } * *

* Various parameters are supported: *
    *
  • none
  • *
  • int
  • *
  • Intent
  • *
  • int, Intent
  • *
  • Intent, int
  • *
* Where int parameters will get the resultCode and Intent parameters will get the Intent.
* Note: Each annotated method shall only have one int and / or Intent variable.
*
* In addition to that other parameter annotations are supported like:
*
    *
  • {@link IntentData} {@link android.net.Uri}
  • *
  • {@link ExtraBoolean} {@link boolean}
  • *
  • {@link ExtraByte} {@link byte}
  • *
  • {@link ExtraChar} {@link char}
  • *
  • {@link ExtraDouble} {@link double}
  • *
  • {@link ExtraFloat} {@link float}
  • *
  • {@link ExtraInt} {@link int}
  • *
  • {@link ExtraLong} {@link long}
  • *
  • {@link ExtraShort} {@link short}
  • *
  • {@link ExtraString} {@link java.lang.String}
  • *
* * @since 0.1.0 */ @Retention(CLASS) @Target(METHOD) public @interface OnActivityResult { /** * @return requestCode that should be >= 0
* Upon receiving the requestCode the method will be called * @since 0.1.0 */ int requestCode(); /** * @return result codes that should be either {@link android.app.Activity#RESULT_CANCELED}, {@link android.app.Activity#RESULT_OK} or {@link android.app.Activity#RESULT_FIRST_USER}.
* Only upon receiving the the given resultCodes the method will be called.
* Default behaviour is that for all resultCodes the method will be called. * @since 0.2.0 */ int[] resultCodes() default {}; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy