I am looking for a way to automate showing and hiding a \'loading\' message when calling an async service, so instead of doing this:
showLoadingWidget();
se
You could create a default callback superclass which takes a LoadingMessage object argument in its constructor, and provides hook methods for subclasses, e.g. onSuccess0 and onFailure0.
The implementation would be similar to:
public final void onFailure(Throwable caught) {
loadingMessage.hide();
onFailure0(caught);
}
protected abstract void onFailure0(Throwable caught);