Skip to content
pyricau edited this page Oct 30, 2012 · 4 revisions

Since AndroidAnnotations 2.7

@FragmentArg

The @FragmentArg annotation indicates that a fragment field should be injected with the corresponding Fragment Argument.

If you do not provide any value for the @FragmentArg annotation, the name of the field will be used.

Usage example:

@EFragment
public class MyFragment extends Fragment {

  @FragmentArg("myStringArgument")
  String myMessage;

  @FragmentArg
  String anotherStringArgument;
	
  @FragmentArg("myDateExtra")
  Date myDateArgumentWithDefaultValue = new Date();

}

The fragment builder will hold dedicated methods for these arguments:

MyFragment myFragment = MyFragment_.builder()
  .myStringArgument("Hello")
  .anotherStringArgument("World")
  .build();

Using AndroidAnnotations

Questions?

Enjoying AndroidAnnotations

Improving AndroidAnnotations

Clone this wiki locally