• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Handling add/update/delete in RecyclerView

RhinoCan

Well-Known Member
Can anyone point me to a complete example of an app that displays data in a RecyclerView and then provides options to add new records, and update or delete existing records (sometimes known as a CRUD)? I've been working through a YouTube video series by Coding in Flow and it's been very helpful but, presumably to keep the videos basic, he only does very trivial add/update/delete logic, all right there in his main activity. I am trying to do more realistic code and make my user press icons to take them to separate activities for add, update and delete.

I am encountering a major problem with this design though. I'm not having any trouble gathering and validating the data but when I return to my main activity to complete the add, update or delete via the adapter, I get a null pointer exception on the adapter. Clearly, I have no reference to the adapter any more when I come back from the add/update/delete activity. I expect that my basic design is wrong. Maybe I need to use fragments instead of activities. Maybe I need to pass a reference to the adapter to the add, update and delete activities. I'm really not sure which is why I'm asking for an example. I would also happily take your advice if you have experience with this :-)
 
Back
Top Bottom