0

My RecyclerView takes a few seconds to load it's items. This is fine, but I want it to load its items before my RecyclerView is visible.

I have seen this answer, but it isn't exactly what I'm looking for - I want my RecyclerView to call the Adapter's onCreateViewHolder() and onBindViewHolder() methods, again, BEFORE the RecyclerView is visible. Is this possibe?

poppy
  • 247
  • 2
  • 15

1 Answers1

0

your approach should be to 1.Show RecyclerView blank (nothing is visible) when UI is creating.

recyclerView.setLayoutManager(myLayoutManager);
recyclerView.setAdapter(myAdapter); // with no data
  1. After Loading data into your data elements/holder to be shown in RecyclerView, just refresh RecyclerView

    myAdapter.setData(yourdata); // set data will be user defined method myAdapter.notifyDataSetChanged();

Lee ABK
  • 361
  • 3
  • 6