I have AsyncTask , which I want to remake in Rx
Here is my AsyncTask
new AsyncTask<Void, Void, Void>() { ArrayList<CallServiceCode> undoneServiceCodes = new ArrayList<>(); HashMap<String, ServicePartFormQuestionsManager> undoneForms = new HashMap<>(); boolean isHasAtLeastOneDoneServiceCode = false; @Override protected void onPreExecute() { super.onPreExecute(); if (iCloseCallListener != null) { iCloseCallListener.onPreValidation(); } } @Override protected Void doInBackground(Void... params) { undoneServiceCodes = getUndoneServiceCodes(); undoneForms = getUndoneForms(); isHasAtLeastOneDoneServiceCode = isHasAtLeastOneDoneServiceCode(); return null; } @Override protected void onPostExecute(Void iVoid) { super.onPostExecute(iVoid); if (iCloseCallListener != null) { iCloseCallListener.onPostValidation(undoneServiceCodes, undoneForms, isHasAtLeastOneDoneServiceCode); } } }.execute(); I do not understand how you can perform in the Rx background, you can perform 3 different methods at once, as in the example with AsyncTask when 3 methods are running in the background
- undoneServiceCodes = getUndoneServiceCodes ();
- undoneForms = getUndoneForms ();
- isHasAtLeastOneDoneServiceCode = isHasAtLeastOneDoneServiceCode ();
If this would be one method (let's say the first), I would do it
Flowable.fromIterable(getUndoneServiceCodes())// .subscribeOn(Schedulers.io())// .observeOn(AndroidSchedulers.mainThread())// .doOnSubscribe(iSubscription -> { if (iCloseCallListener != null) { iCloseCallListener.onPreValidation(); } }).toList()// .subscribe(resultList -> { if (iCloseCallListener != null) { iCloseCallListener.onPostValidation(iCloseCallListener, ???, ???); } }); But so I will get the result for only one method running in the background, how to do it so that you can process 3?