I'm learning RxJava 2 and want to learn more on how to use it for Android development.
One thing I'm not quite sure of is subscribing to an observable only once in an event handler. For example, a button click triggering a network call.
The main reason for wanting to subscribe only once is because you don't want to have concurrent network calls for the same request.
I'm reading RxJava for Android developers, and they fix this by using RxBinding library to convert the button clicks to an observable and subscribe to that instead of subscribing to an observable onClick. But I've never seen this in the codebases I work in.
Is it correct to way to handle this? If you didn't use RxBinding, then how do you subscribe and trigger a network call only once on a click?
Some pseudocode would be highly appreciated (preferably in Kotlin but Java is fine too).