androidandroid-recyclerviewrecyclerview-layout

Can someone explain what getItemCount method in RecyclerView.LayoutManager return?


The documentation says the following about getItemCount():

Returns the number of items in the adapter bound to the parent RecyclerView. Note that this number is not necessarily equal to State#getItemCount().

So, does it return all the items in the adapter or the items that are visible on the screen? I don't get it. Can someone explain this method?


Solution

  • getItemCount() - returns The number of items currently available in adapter

    Reference: