Updating a ListView with CursorLoader was an easy way to display data from the database into the user interface. Modified modifications that extend to the user interface without additional work and may not be as effective.
RecyclerView.adapter provides access to more granularity, allowing you, for example, to specify the adapter that deleted a particular item.
But what is the best way to name these preferred methods (notifyItem *) by replacing notifyDataSetChanged?
Obviously, the adapter does not have to comply with the contentProvider, otherwise it will not know the nature of the model modification (as before).
You can use various templates, such as adding a bus to publish changes from the supplier, creating a single-element type model that will contain a link to the adapter, possibly using presenters (entered in L) or creating a service with a link to the action.
Here is a general example: the synchronization process inserts a record in the database (or a gcm notification is received, which also inserts a record in the database), then I want the interface (if it was running) to be updated by calling notifyItemInserted. Where to place this call?
Thanks.
source share