Magic Marbles Magic Marbles - 2 years ago 143
Android Question

RxJava in Android has no Observable.create?

I'm trying to run this example from here

Observable<String> values = Observable.create(o -> {
Subscription subscription = values.subscribe(
v -> System.out.println("Received: " + v),
e -> System.out.println("Error: " + e),
() -> System.out.println("Completed")

Aside from the fact that I can't use Lambda in Android Studio, there is no Observable.create(). The only option I have is Observable.class?

I'm using version 1.1.6 and getting the library via Gradle.

Answer Source

IntelliJ has probably imported java.util.* which includes java.util.Observable

Add an import for rx.Observable and it should work again.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download