@Retention(value=CLASS)
@Target(value=METHOD)
public @interface IgnoredWhenDetached
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
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
@IgnoredWhenDetached
void killActivity() {
getActivity().finish();
}
@IgnoredWhenDetached
void updateTitle(String title) {
getActivity().setTitle(title);
}
}
EFragment,
UiThread,
Background,
HandlerCopyright © 2010-2014. All Rights Reserved.