Android - Can You Update A Cursor For Sqlite Results?
One of my methods returns a Cursor from some SQLite query results. As I'm navigating through the cursor, there are some records I want to change/update. Can I update directly with
Solution 1:
You can not directly update records with the cursor. Read the Android Cursor doc.
Solution 2:
You need to implement a Content Provider that allows to update the record, in short you need to override the update function in your ContentProvider class.
publicint update(Uri uri, ContentValues values, String where, String[] whereArgs)
In short you'll have to update them, this is not done directly from the data received in the Cursor.
Solution 3:
To do that the best way is to implement a content provider for your data http://developer.android.com/guide/topics/providers/content-providers.html
You can use framework like datadroid for that http://datadroid.foxykeep.com/
Post a Comment for "Android - Can You Update A Cursor For Sqlite Results?"