0

In my Fragment i have three RecyclerView inside NestedScrollView I am using GlobalScope.launch(Dispatchers.IO){ } to get the data from API but after successfully get the data when i am trying to set adapter to RecyclerView but it freez the UI for 1-3 seconds.

  • I would suggest you to not use recyerlview in scrollview. But you can have one parent rv and some nested child rv – Raghunandan Feb 20 '21 at 07:03
  • I used multiple RecyclerViews in one UI before. How much datas you set to the adaper at one time? Contains huge image? If the data is too huge which large memory is occupied, it may freez the UI. If data is too large, you could try the Paging of JetPack https://developer.android.com/jetpack/androidx/releases/paging – Matrix Feb 20 '21 at 08:54
  • @Raghunandan why not to use recyclerview in scrollview? can you give me a good reference and example for what you saying? – Hamid Sj Feb 20 '21 at 09:19
  • @HamidSj if you recycyler view in nested scrollview you loose the recycler views are not recycled. Check this https://stackoverflow.com/questions/37590651/recyclerview-does-not-recycling-views-when-use-it-inside-nestedscrollview. i think the general rule that applies to listview also applies to recylerview – Raghunandan Feb 20 '21 at 13:55

0 Answers0