@Retention(value=CLASS) @Target(value={FIELD,METHOD,PARAMETER}) public @interface Extra
Use on any native, Parcelable or
Serializable field in an EActivity
annotated class to bind it with Android's arguments. If
Parceler is on the classpath, extras
annotated with @Parcel, or collections supported by Parceler will be
automatically marshaled using a Parcelable
through the Parcels utility class.
The annotation value is the key used for extra. If not set, the field or method name will be used as the key.
When Extra is used, the intent builder will hold dedicated methods
for each annotated fields.
Your code related to injected extra should go in an AfterInject
annotated method.
Calling Activity#setIntent(Intent) will automatically update the annotated extras.
Example :
@EActivity
public class MyActivity extends Activity {
@Click
void buttonClicked() {
MyExtraActivity_.intent(this) //
.myMessage("test") //
.startActivity();
}
}
@EActivity
public class MyExtraActivity extends Activity {
@Extra
String myMessage;
@Extra
void singleInjection(String myMessage) {
// do stuff
}
void multiInjection(@Extra String myMessage, @Extra String myMessage2) {
// do stuff
}
@AfterInject
void init() {
Log.d("AA", "extra myMessage = " + myMessage);
}
}
AfterInject,
EActivitypublic abstract String value
Copyright © 2010–2020 simpligility technologies inc.. All rights reserved.