I found this question: Member variable which must extend class A and implement some interface
and was wondering if there is a better way. Passing it as a parameter in a method works:
public <T extends Activity & IMyInterface> void start(T _callback) {
callback = _callback;
}
but how to correctly declare callback
as attribute? This:
Class<? extends Activity & IMyInterface> callback;
gives a syntax error.