我的活动无法实现lifecycleOwner

时间:2018-04-13 08:31:27

标签: android android-activity lifecycle

我正在使用android studio,而build.gradle中的依赖项在这里

implementation 'android.arch.lifecycle:runtime:1.1.1'
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation 'android.arch.lifecycle:reactivestreams:1.1.1'
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"

这是我使用

的功能
private Single<MediaStream> getMediaStream() {
    Single<MediaStream> single = RxHelper.single(MediaStream.
            getBindedMediaStream(this, this), mediaStream);
    if (mediaStream == null) {
        return single.doOnSuccess(new Consumer<MediaStream>() {
            @Override
            public void accept(MediaStream ms) throws Exception {
                mediaStream = ms;
            }
        });
    } else {
        return single;
    }
}

这是getBinderMediaStream:

public static Publisher<MediaStream> getBindedMediaStream(
        final Context context, LifecycleOwner owner){
    final MediaStreamPublisher publisher = new MediaStreamPublisher(context, owner);
    return publisher;
}

错误是:错误的第二个参数类型。发现:&#39; com.example.mtTest.testActivity&#39;,required:&#39; android.arch.lifecycle.LifecycleOwner&#39;。

请帮帮我

0 个答案:

没有答案