Run void method in background

后端 未结 1 1903
猫巷女王i
猫巷女王i 2021-02-12 15:19

I want to run a method in background using rxjava. I don\'t care about the result.

void myHeavyMethod() { (...) }

So far the only solution I ha

1条回答
  •  南旧
    南旧 (楼主)
    2021-02-12 15:44

    The fromAction() method is what you're looking for.

    Completable.fromAction(this::myHeavyMethod)
    

    0 讨论(0)
提交回复
热议问题