There is a DB. There is a list that displays all entries from it. In the same activity there is the possibility of adding data to the database. How best to make an auto-update list? I use RecyclerView . Passing ArrayList<String> . There are several options, as I understand it:
1) Add data to the database and the same data in the ArrayList and call notifyDataSetChanged .
2) Add data to the database, again take all the data, create an adapter and assign it to the list
3) Transfer the cursor to the adapter. Just add data to the database and call the requery the cursor (is it necessary?)
Which option is the best? What are not? Why? Are there any other ways?
CursorLoaderand therestart()method. About anyArrayListand other perversions with distillation from the cursor into which intermediate lists you can immediately forget - it is pointless and merciless. - pavlofffCursorAdapterdid not understand, can it be used withRecyclerView? - FlippyRecyclerViewaboutRecyclerView... there are no adapters for it at all. Well, you can make your own, based on the class forListView, although I would recommend making a simple adapter with the data from the passed cursor and working withCursorLoader- this will solve a lot of not obvious problems in the future, although at first it seems more complicated. Tomorrow, if the time is a normal answer I will write. While you can see an example with the CursorLoader , it is true with the ListView, but for understanding this is not important. Filtering here - updating the list in fact - pavlofff