【发布时间】:2016-03-07 16:03:24
【问题描述】:
我正在尝试将 Kotlin RxJava 和 retrofit2 结合起来。
@GET("/xxxxxxxxxxxx/{id}.json")
fun getHotel(@Part("id") id : String) : Observable<Response<Hotel>>
当我尝试调用这个方法时(getHotels()):
var subscription = HotelsFactory.getHotelService((activity.applicationContext as App)
.client)
.getHotel(arguments.getInt("id").toString())
.subscribeOn(Schedulers.computation())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({response -> showHotels(response)})
{throwable -> throwable.printStackTrace()}
mSubscription.add(subscription)
我拿这个:
@Part 参数只能用于多部分编码。
【问题讨论】:
-
你应该使用
@Path而不是@Part
标签: android rx-java kotlin retrofit2