What's the correct way to unsubscribe from Sin

2019-08-26 06:13发布

This question already has an answer here:

I want to do something after short delay:

public void notifyMe() {
Single
       .timer(500, TimeUnit.MILLISECONDS)
       .subscribeOn(Schedulers.io())
       .subscribe(ignore -> service.notifyMe()));
}

Now I have a warning: "The result of subscribe is not used". How can I fix it?

1条回答
爷的心禁止访问
2楼-- · 2019-08-26 06:24

A Single will only call once. Upon calling either method, the Single terminates and the subscription to it ends.

Link can be referred for more information.

查看更多
登录 后发表回答