@Retention(value=CLASS) @Target(value=METHOD) public @interface IgnoreWhen
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
DETACHEDthe EFragment views are destroyed
VIEW_DESTROYED.
Should be used on method that must meet the following criteria
1) Can only be used in conjunction with classes annotated with
EFragment
2) The annotated method MUST return void and MAY contain parameters.
Example :
@EFragment
public class LoaderFragment extends Fragment {
...
@UiThread
@IgnoreWhen(IgnoreWhen.State.DETACHED)
void killActivity() {
getActivity().finish();
}
@IgnoreWhen(IgnoreWhen.State.VIEW_DESTROYED)
void updateTitle(String title) {
getActivity().setTitle(title);
}
}
EFragment,
UiThread,
Background,
Handler| Modifier and Type | Required Element and Description |
|---|---|
IgnoreWhen.State |
value
The lifecycle state after the method should not be executed.
|
public abstract IgnoreWhen.State value
Copyright © 2010–2018 simpligility technologies inc.. All rights reserved.