I have a fragment that I want to reuse. Its functionality is the same, only layout changes
I use roboguice to inject id views into variables
I added this view, for example:
@Nullable
@InjectView(R.id.edtEventLocationAddress)
private EditText edtEventLocationAddress;
this view may or may not be present in this layout i, presented in the onCreateView method
that's why i put on it @Nullable
however, when I launch the application, with a layout that does not have this representation, I get
java.lang.NullPointerException: Can't inject null value into class
com.myapp.CreateEventPageFragment.edtEventLocationAddress when field is not @Nullable
What do I need to do so that roboguice allows me to reuse fragments and only change their presentation?
source
share