One class for a file rule in Java confuses me a bit. I am writing an Android application and trying to implement the accepted answer to this question:
Generic class for AsyncTask in Android?
which requires an interface definition that implements class A, and class B takes its constructor as an argument.
So I need A.java and B.java, but where is the interface going? Does he need a separate java file? Should I define it inside A and B? If not, how to import it?
I will also have about 10 different AsyncTask classes, but I donβt want to worry about creating a new file for each of them. What would you suggest? Is there a way to put all 10 classes in one file? Or should I create a large if / then block inside the class and pass an argument telling which of the 10 different tasks I want to do?
user317033
source
share