recyclerview No adapter attached; skipping layout

后端 未结 30 3149
走了就别回头了
走了就别回头了 2020-11-21 04:51

Just implemented RecyclerView in my code, replacing ListView.

Everything works fine. The data is displayed.

But error messages are

30条回答
  •  执念已碎
    2020-11-21 05:16

    Solved by setting the initialized empty list and adapter at the bottom and calling notifyDataSetChanged when results are fetched.

        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
        recyclerviewItems.setLayoutManager(linearLayoutManager);
        someAdapter = new SomeAdapter(getContext(),feedList);
        recyclerviewItems.setAdapter(someAdapter);
    

提交回复
热议问题