Android Can you update the Cursor results for SQLite?

One of my methods returns Cursor from some SQLite query results.

When I move the cursor, there are some entries that I want to change / update. Is it possible to update the cursor directly? Or do I need to manually UPDATE use the identifier of the entry from the cursor?

+6
source share
3 answers

You cannot directly update records with the cursor. Read the Android Cursor doc .

+4
source

You need to implement a content provider that allows you 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 have to update them, this is not done directly from the data received in the cursor.

This and this link should help.

+2
source

To do this, it’s best to implement a content provider for your data http://developer.android.com/guide/topics/providers/content-providers.html

You can use the framework as a datadroid for http://datadroid.foxykeep.com/

+1
source

Source: https://habr.com/ru/post/900569/


All Articles