I have managed to successfully write a service that downloads data from an RSS feed, parses it, and save it to a database. I also have an activity fragment which uses the cursor loader technique to retrieve all data rows and displays them on screen in a horizontal listview I scavenged off the internet.
My next mission is to modify the activity so that I can continually query for the next x number of rows every time the user scrolls to near the end of the listview and add them to the listview. Technically my data is small enough that if I showed 10 rows at startup, I could probably just query for 20 and reset the adapter – but it seems silly to have to re-query the same rows repeatedly.
So essentially my main question is: how best would I combine the currently held listview contents populated with a Cursor/CursorAdapter with the results of a fresh query using the LoaderCallbacks?
Secondly, what is the correct syntax for the limit parameter of the SQLiteQueryBuilder? I have tried many variations although I think a string of “offset, maxrows” is correct? No matter what I provide though I am always getting 0 from getCount() on my cursor.
Use an ArrayList of your items inside your Adapter, when you have new items to display, just create a method to insert them into the ArrayList.
Question about SQL you can find on that link http://developer.android.com/reference/android/database/sqlite/SQLiteQueryBuilder.html
you have to add the limit on then method buildQuery, if that doesn’t work, please paste here your code