sqlite - Android: Increment DB field via ContentValues -


I am updating an item in the getContentResolver () in a ListView. Update () method, and I want to increase a 'View' field through a ContentValue, but it is not possible that it can detect.

I call it raw SQL SET views = views + 1 , but cv.put ("views", "views + 1") in the view area Setting a content value as the result is clearly set to "View + 1"

Thanks,

Paul

On this Any signal, or have I left for a more manual approach? Update:

I have gone back to using raw SQL to update for now, and then manually underlying the change via getContentResolver () Inform cursor adapter. NotifyChange () . If I call it directly getContentResolver () If you can understand one way to do it through Update () then it will still be very good, so if someone has a way to do this, then post it here.

Its final solution is the custom URI (with the lines of the code) Using a ContentProvider such as getContentResolver () to call a / item / 5 / updateviews ). Updating (customUri, ...) is going to URI to avoid the need to pass the values ​​for update () my content provider's The overridden update () method tells the increase in the number of views of this item through the ContentValues ​​ parameter.

Comments