onactivityresult.Extra Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of onactivityresult-annotations Show documentation
Show all versions of onactivityresult-annotations Show documentation
OnActivityResult annotation compiler for Android
package onactivityresult;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.CLASS;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
/**
* parameters of a {@link OnActivityResult} annotated method can be annotated to get an extra of the Intent
* The type of the variable will be automatically derived.
*
* Supported types are:
*
* - boolean
* - byte
* - char
* - double
* - float
* - int
* - long
* - short
* - String
*
* Example:
*
*
* @OnActivityResult(requestCode = 1)
* void onResult(@Extra final String extra) {
* // Do something
* }
*
*
*
* extra name: same as parameter
* NOTE: In this case it would be extra
*
* Since the type will be derived it's not possible to set a default value via the annotation. In case the Intent does not contain the extra, type default values will be provided automatically.
* If you want set a deafult value use one of those annotations: {@link ExtraBoolean}, {@link ExtraByte}, {@link ExtraChar}, {@link ExtraDouble}, {@link ExtraFloat}, {@link ExtraInt}, {@link ExtraLong} and {@link ExtraShort}
*
* @since 0.3.0
*/
@Retention(CLASS)
@Target(PARAMETER)
public @interface Extra {}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy