我有以下代碼從互聯網獲取項目列表。從Observable獲取前5個項目,從網絡調用獲取數據
Observable<RealmList<Artist>> popArtists = restInterface.getArtists();
compositeSubscription.add(popArtists.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()).subscribe(artistsObserver));
麻煩的是列表中有超過80個項目,我只希望拿到第5個項目。達到此目的的最佳方法是什麼?
沒有終點,讓您指定限制或頁面大小? – Blackbelt
'拿(5)'在Observable上? –
@ cricket_007'take(5)'工作。謝謝。 –