【发布时间】:2018-07-02 21:50:24
【问题描述】:
我有点卡在下面。
我正在使用 Retrofit 和 RxJava2,我设法通过使用 Observable.zip 和 return Arrays.asList(list1, list2, list3); 获得了 List<List<CustomModel>>,它现在看起来如下所示:
[list1,list2,list3]
我可以使用以下方法访问列表并打印每个单独的项目:
for (List<CustomModel> b : customModel) {
for (customModel c : b) {
Print INDIVIDUAL ITEMS
Log.d("id: ", c.getId());
Log.d("name: ", c.getName());
Log.d("symbol: ", c.getSymbol());
Log.d("rank: ", c.getRank());
}
但我无法使用以下方法将数据发送到我的自定义适配器:
recyclerAdapter = new RecyclerAdapter(getApplicationContext(), b);
recyclerView.setAdapter(recyclerAdapter);
recyclerAdapter.notifyDataSetChanged();
swipeRefreshLayout.setRefreshing(false);
只给我数组上的最新列表,而不是过去的列表,因为在将数据传递到我的 recyclerview 时它们会被覆盖。
在 recyclerView 中显示所有 3 个列表的最佳方式是什么?
【问题讨论】:
标签: java android android-studio android-recyclerview retrofit2