Rxjava分页递归-RxJava

我正在使用改造和rxjava2。我有一个问题,那就是当我第一次打开应用程序或打开新活动时,我必须使用限制和偏移量从服务器检索数据。然后将数据存储回本地数据库(领域数据库)中。 API服务界面如下:

@GET(ApiUri.GET_LIST_CITY)
fun getlistOfCityWithOutParameter(
        @Query("limit") limit: Int,@Query("offset") offset: Int
): Observable<ResponseDataList<ResponseDataCityWithoutParameter>>

ResponseDataList像这样:

class ResponseDataList<T> : BaseResponse() {
    @SerializedName("results")
    @Expose
    var result: MutableList<T>? = null
}

和BaseResponse()函数可在显示数据方面实现REST服务器的响应。像这样:

open class BaseResponse {
    @SerializedName("status")
    var status: Int = 0
    @SerializedName("code")
    var code: Int = 0
    @SerializedName("message")
    var message: String? = null
    @SerializedName("generated")
    var generated: String? = null
    @SerializedName("serverTime")
    var serverTime: String? = null
    @SerializedName("totaldata")
    var totaldata: Int = 0
    @SerializedName("totalresult")
    var totalresult: Int = 0
}

然后我问如何使用rxjava进行分页API进行调用,直到检索到所有数据为止。

xiaotong11 回答:Rxjava分页递归-RxJava

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3075509.html

大家都在问