Android: SQLite transactions when using ContentResolver

前端 未结 4 1941
一个人的身影
一个人的身影 2020-12-12 14:30

The goal: refresh database from XML data

The process:

  • Start transaction
  • Delete all existing rows from the ta
4条回答
  •  臣服心动
    2020-12-12 15:12

    I've seen that in the source code of Google I/O application, they override ContentProvider's applyBatch() method and use transactions inside of it. So, you create a batch of ContentProviderOperation s and then call getContentResolver().applyBatch(uri_authority, batch).

    I'm planning to use this approach to see how it works. I'm curious if anyone else has tried it.

提交回复
热议问题