How to extend from AsyncTask as a base base class?

There are three different options for implementing AsyncTask :

 public class DownloadTask extends AsyncTask<String, Integer, Boolean> public class JsonParserTask extends AsyncTask<Object, Void, Boolean> public class PostCommentTask extends AsyncTask<String, Void, HttpRequestResult> 

I would like them to extend BaseAsyncTask , which I can use for dependency injection. The sign of the AsyncTask class is as follows:

 public abstract class AsyncTask<Params, Progress, Result> 

How can I extend AsyncTask while saving different parameters?

  | DownloadTask AsyncTask <-- BaseAsyncTask <--| JsonParserTask | PostCommentTask 
+4
source share
1 answer

Try:

 abstract class BaseAsyncTask<Params, Progress, Result> extends AsyncTask<Params, Progress, Result> 
+12
source

All Articles