What is the difference between
Semantically they are the same, just syntactic sugar.
layoutinflater.fromis used in
onCreateViewHoldermethod in RecyclerView?
onCreateViewHolder method, you should instantiate a place-holding view, which later will be used to display a row. If you want to instantiate the row view from a
xml file, you should inflate that file which gives a view. The inflation process is done through a
LayoutInflater object. If you don't want to use a
xml, you won't need that inflater.
What is the purpose of
Without this, how would that recycler view know how many rows this list would have? The recycler view first calls this method and subsequently calls
getItem methods based on it.