His addition to Marek Seberβs answer, he indicated the use of a handler. To make the code simple and intuitive, use the interface. This is not an alien concept, we constantly use it for callback functions (for example, OnClickListner, etc.). The code will look something like this.
public class InnerTask extends AsyncTask<...> { interface ResultHandler { void gotResult(<> result); } private ResultHandler myResult;
If we want to use the same AsynTask class on multiple sites, we can use this type of implementation instead of using nested classes.
source share