-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Twitter/app/src/main/java/com/codepath/apps/restclienttemplate/TweetsAdapter.java
Line 62 in 934e949
| notifyDataSetChanged(); |
Not sure if you will eventually learn this in codepath, but notifyDataSetChanged is a heavy handed way of updating an adapter especially if you are dealing with lots of items.
If you happen to know for instance that you are adding only a single new item there is a method notifyItemInserted, etc... that let you control in a more nuanced manner. The advantage of using these more nuanced calls is that Android can animate them in for a more seamless experience.
If many things are changing at once you don't have to keep track yourself. Consider using DiffUtil to figure our difference between what is currently in the adapter and what you want to change it to. https://developer.android.com/reference/androidx/recyclerview/widget/DiffUtil
This is just something to consider for instance when you are thinking about your independent project and want to polish the experience.