Magic Marbles
Magic Marbles

Reputation: 403

RxJava in Android has no Observable.create?

I'm trying to run this example from here

Observable<String> values = Observable.create(o -> {
    o.onNext("Hello");
    o.onCompleted();
});
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.

Upvotes: 0

Views: 244

Answers (1)

Kiskae
Kiskae

Reputation: 25573

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

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

Upvotes: 5

Related Questions