I need to refresh / rebind ListView or RecyclerView contents without refreshing the header item itself.
Any tips on how to achieve this?
Thanks.
Yes, you can do this. Generally, your header has 0 position in the list, so the header places on the top of your list. So, for your lists, e.g. RecyclerView
you must initialize the adapter (in case of RecyclerView
you must create accessor of RecyclerView.Adapter
class) and this adapter has a lot of methods for updating data in adapter (notifyDataSetChanged(), notifyItemInserted()
etc.) and you can use one of this methods, depends on your purpose. So, in your case you can use notifyItemRangeChanged(int positionStart, int itemCount)
.
You can find more information about these methods in the official documentation