I want to run a method in the background using rxjava. I don't care about the result.
void myHeavyMethod() { (...) }
So far, the only solution I have is to change the return type, for example. boolean .
boolean myHeavyMethod() { (...) return true; }
Then I run:
Completable.defer(() -> Completable.fromCallable(this::myHeavyMethod)) .subscribeOn(Schedulers.computation()) .subscribe( () -> {}, throwable -> Log.e(TAG, throwable.getMessage(), throwable) );
Is there a way to do this while keeping the void return type?
rx-java rx-java2
Marcin kunert
source share