Reputation: 91193
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 the cursor? Or do I have to manually UPDATE
using the record ID from the cursor?
Upvotes: 10
Views: 14012
Reputation: 4676
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.
public int 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.
This and this link should help.
Upvotes: 3
Reputation: 3485
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/
Upvotes: 0
Reputation: 10177
You can not directly update records with the cursor. Read the Android Cursor doc.
Upvotes: 5