My two cents: don't go through your own ContentProvider unless you need to.

Use ContentProvider for exporting data to other apps, or, within the app, for very specific URIs that should trigger UI updates.

For the rest of the data, that is, those db ops that don't need to trigger UI updates, going directly to the database APIs gives better flexibility, performance, and control (wrt. change notifications).

-- Kostya

04.11.2011 20:36, Pepijn Van Eeckhoudt пишет:
Override ContentProvider#applyBatch, start a transaction on your database, apply all the operations and then commit (or rollback) the transaction. The default implementation delegates each operation to the corresponding ContentProvider method so you can probably do this as:

startTransaction
try {
super.applyBatch
setTransactionSuccesful
} finally {
endTransaction
}

Pepijn

On 03/11/2011 20:59, Flávio Faria wrote:
Hi guys,

I have a ContentProvider in my app that wraps an SQLite database. I'm
wondering what is the best way to call insert(), update(), delete()
and query() inside a database transaction. Is it possible? Is there
any workaround? bulkInsert() doesn't help since it only makes insert()
calls.

Thanks.



--
Kostya Vasilyev

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to