相关内容
无法为io.reactivex.Observable创建调用适配器怎么办?(2 个回答)
我将发送一个简单的get方法到我的服务器(它是rails应用程序),并使用rxjava和retrofit获取结果。 我做的事情是: 我的界面:public interface apicall { string service_endpoint = https:198. 50.214.15; @get(apipost) io.reactivex.observable getpost(); 我的模型是这样的: public class post{ @serializedna...

RxJava1.X升级到RxJava2.X笔记
描述 rxjava 1.x rxjava 2.x package包名 rx.xxx io.reactivex.xxx reactivestreams规范 1.x早于reactive streams规范出现,仅部分支持规范 完全支持 backpressure 背压 对背压的支持不完善observable设计为不支持背压新增flowable支持背压 null空值 支持 不再支持null值,传入null值会抛出 nullpointerexception ...
RxJava2.x 操作符之 compose
原始的写法为:subscribeon(schedulers.io()).observeon(androidschedulers.mainthread())我们可以将上面的操作封装成一个简单的工具类来使用,我这里提供了 java 版和 kotlin 版本:java 版本:import io.reactivex.flowabletransformer; import io.reactivex.maybetransformer; import io.reactivex.observable...

Android MVP框架搭建与使用(含源码)
import io.reactivex.observable; import retrofit2.http.get; ** * apiservice接口 统一管理应用所有的接口 * @author llw *public interfaceapiservice { ** * 获取数据列表 * @return gankresponse *@get(apiv2datacategorygirltypegirlpage1count10) observable getlist(); 现在你的这个gankresponse肯定是报红的...

Android OkHttp+Retrofit+RxJava搭建网络访问框架
import io.reactivex.observable; import io.reactivex.functions.function; ** * 网络错误处理 *public class httperrorhandler implements function{ ** * 处理以下两类网络错误: * 1、http请求相关的错误,例如:404,403,socket timeout等等; * 2、应用数据的错误会抛runtimeexception,最后也会走到这个函数...

Android项目实战(六十一):pdf文件用图片方式预览
import io.reactivex.observable; import io.reactivex.android.schedulers.androidschedulers; import io.reactivex.schedulers.schedulers; public class pdfrendererbasicviewmodel extends androidviewmodel{ private static final string tag = pdfrendererbasic; ** * the filename of the pdf. * private ...
基于Rxjava实现轮询定时器
import io.reactivex.observable; import io.reactivex.observer; import io.reactivex.android.schedulers.androidschedulers; import io.reactivex.disposables.disposable; ** * rxjava2.x实现轮询定时器. * * @author xuzhuyun *public class rxtimerutil{ private static disposable mdisposable; ** * milli...
RxJava2和Retrofit2封装教程(整洁、简单、实用)
rxjava2相比rxjava1优化和改动不少了东西,网上有很多大神写的文章,这里就不粘贴复制了。 封装的过程有什么问题、疑问,请在下方留言。 下面话不多说了,来一起看看详细的介绍吧封装教程如下:核心网络请求:package com.lin.netrequestdemo.data; import android.util.log; import io.reactivex.observable; import...
JvmMultifile 注解在 Kotlin 中的应用
singleext.kt ** * shortcut method to change t instance into single instance *fun t.tosingle(): single { return single.just(this) } 接下来的代码,实现将任意类型的list转成observable实例1 2 3 4 5 6 7 8 9 10 packagecom.example.jvmannotationsample import io.reactivex.observable filename:observable...
Android 中 RxJava2 的实际使用
库android 中 rxjava 的使用rx相关依赖implementation io.reactivex.rxjava2:rxandroid:2. 0.2implementation io.reactivex.rxjava2:rxjava:2.1...subscribe { }分线程操作javaobservable .create(new observableonsubscribe(){ @override public void subscribe(observableemitter emitter) throws ...
Android OkGo网络请求库 自定义回调支持带泛型的对象
import com.lzy.okrx2.adapter.observablebody; import io.reactivex.observable; import io.reactivex.scheduler; import io.reactivex.android...46 回调转json rxjava implementation io.reactivex.rxjava2:rxjava:2. 1. 10 rx rxandroid implementation io.reactivex.rxjava2:rxandroid:2. 0.2 rx ...
RxJava 2.0还没熟悉,RxJava 3.0说来就来了!(基础篇)
io.reactivex.flowable:发送0个n个的数据,支持reactive-streams和背压io.reactivex.observable:发送0个n个的数据,不支持背压,io.reactivex.single:只能发送单个数据或者一个错误io.reactivex.completable:没有发送任何数据,但只处理 oncomplete 和 onerror 事件。 io.reactivex.maybe:能够发射0或者1个数据...

大佬们,一波RxJava 3.0来袭,请做好准备~
在 rxjava 3 可以发现有以下几个基类(跟rxjava 2是一致的吧):io.reactivex.flowable:发送0个n个的数据,支持reactive-streams和背压io.reactivex.observable:发送0个n个的数据,不支持背压,io.reactivex.single:只能发送单个数据或者一个错误io.reactivex.completable:没有发送任何数据,但只处理 oncomplete...
Rxjava实战笔记 | Rxjava的基本使用解析(同步结合示例)
添加依赖compile io.reactivex.rxjava2:rxjava:2. 0.0-rc5compile io.reactivex.rxjava2:rxandroid:2.0. 0-rc1----基理observable和observer通过subscribe()方法实现订阅关系; rxjava中是自动发送事件的, 一旦订阅就开始发送; ----基本使用三个步骤? 第一步,创建observable, emitter是发射器的意思,在subscribe...

给 Java 和 Android 构建一个简单的响应式Local Cache
import io.reactivex.observable; import io.reactivex.functions.consumer; ** * created by tony on 2018929. *public class test { public static void...import io.reactivex.observable; import io.reactivex.functions.consumer; import org.springframework.context.applicationcontext; importorg.spring...
RxJava2 入门详细笔记(2)
ble.run(observablefromarray.java:111) atio.reactivex.internal.operators.observable.observablefromarray.subscribeactual(observablefromarray.java:37) at io.reactivex.observable.subscribe(observable.java:12090) atio.reactivex.internal.operators.observable.observableelementatsingle.subscribeactual...

Rxjava2-小白入门(二)
import io.reactivex.observable; import io.reactivex.observableemitter; import io.reactivex.observableonsubscribe; import io.reactivex.observer; import io.reactivex.disposables.disposable; public class mainactivity extends appcompatactivity{ private static final string tag = mainactivity...

Transformer 在RxJava中的使用
import io.reactivex.maybetransformer; import io.reactivex.observable; import io.reactivex.observablesource; import io.reactivex.observabletransformer; import io.reactivex.single; import io.reactivex.singlesource; import io.reactivex.singletransformer; import io.reactivex.annotations.nonnull; ...

RxJava 的 Subject
所以,我们使用publishsubject,考虑到多线程的情况,还需要使用 subject 的 toserialized() 方法。 import io.reactivex.observable; import io.reactivex.subjects.publishsubject; import io.reactivex.subjects.subject; public class rxbus { private final subject mbus; private rxbus(){ mbus = publish...

RxJava2学习笔记(2)
先改下支付的实现,人为抛个异常:public class payserviceimpl implements payservice{ @override public observable payorder(payrequest request) throws exception{ throw new exception(支付失败!); }}rxjava里有一个重载版本,见:io.reactivex.observable @checkreturnvalue @schedulersupport(none) public ...