IgnoredWhenDetached
Since AndroidAnnotations 3.1 until AndroidAnnotations 3.3.2
When used standalone in an @EFragment or in conjunction with the @UiThread or @Background annotations, the annotated method will be wrapped in an 'if attached' block such that no code will be executed if the @EFragment is no longer bound to its parent activity.
Should be used on method that must meet the following criteria:
- Can only be used in conjunction with classes annotated with @EFragment
- The annotated method must return void and may contain parameters.
Usage example:
@EFragment
public class LoaderFragment extends Fragment {
[...]
@UiThread
@IgnoredWhenDetached
void killActivity() {
getActivity().finish();
}
@IgnoredWhenDetached
void updateTitle(String title) {
getActivity().setTitle(title);
}
}
Since AndroidAnnotations 4.0.0
When used standalone in an @EFragment or in conjunction with the @UiThread or @Background annotations, the annotated method will be wrapped in an 'if attached' block such that no code will be executed if the @EFragment is no longer bound to its parent activity or the @EFragment views are destroyed
Should be used on method that must meet the following criteria:
- Can only be used in conjunction with classes annotated with @EFragment
- The annotated method must return void and may contain parameters.
Usage example:
@EFragment
public class LoaderFragment extends Fragment {
[...]
@UiThread
@IgnoreWhen(IgnoreWhen.State.DETACHED)
void killActivity() {
getActivity().finish();
}
@IgnoreWhen(IgnoreWhen.State.VIEW_DESTROYED)
void setViewBackground(int resid) {
view.setBackgroundResource(resid);
}
}
Since AndroidAnnotations 4.0.0
AndroidAnnotations currently support two states for ignoring execution:
- DETACHED: Skip execution if the @EFragment is no longer bound to its parent activity.
- VIEW_DESTROYED: Skip execution if the @EFragment views are destroyed.
19/11/2020 The 4.8.0 release is out !
- Get started!
- Cookbook, full of recipes
- Customize annotation processing
- List of all available annotations
- Release Notes
- Examples
- Read the FAQ
- Join the Mailing list
- Create an issue
- Tag on Stack Overflow
- Ask on Gitter