call()方法无法覆盖

时间:2017-09-20 11:42:02

标签: java android rx-java rx-android

我正在学习Android中的RxJava。我正在关注本教程here

我编写了下面发布的代码,如tutoril中所述。但我无法覆盖以下方法

@Override
        public void call(Subscriber<? super String> subscriber) {

        }

尽管如此,教程中提到我必须使用它。 Android studio允许我只覆盖以下方法

@Override
        public void call(Object o) {

        }

但是这个方法不是教程中使用的方法。

请让他们知道如何使用方法中使用的方法

public void call(Subscriber<? super String> subscriber) {

在教程中使用

另外请关注gradle.build belwo,也许我使用的是错误的RxJava库

Observable myObservable = Observable.create(new Observable.OnSubscribe() {

        @Override
        public void call(Object o) {

        }

        //this method cant be overriden
        @Override
        public void call(Subscriber<? super String> subscriber) {

        }
    });

gradle.build

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'

compile 'io.reactivex:rxjava:1.0.10'
compile 'com.netflix.rxjava:rxjava-android:0.16.1'

}

0 个答案:

没有答案