@Retention(value=CLASS) @Target(value={FIELD,METHOD,PARAMETER}) public @interface FragmentArg
Use on any native, Parcelable or
Serializable field in an EFragment
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 argument. If not set, the field or method name will be used as the key.
When FragmentArg 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.
Example :
@EFragment
public class MyFragment extends Fragment {
@FragmentArg
String myMessage;
@FragmentArg
void singleInjection(String myMessage) {
// do stuff
}
void multiInjection(@FragmentArg String myMessage, @FragmentArg String myMessage2) {
// do stuff
}
}
@EActivity
public class MyActivity extends Activity {
@AfterViews
void init() {
MyFragment myFragment = MyFragment_.builder() //
.myMessage("Hello") //
.build();
}
}
EFragment,
FragmentById,
FragmentByTagpublic abstract String value
Copyright © 2010–2018 simpligility technologies inc.. All rights reserved.