“error code 5: database is locked” when using a ContentProvider

后端 未结 2 1616
没有蜡笔的小新
没有蜡笔的小新 2021-01-18 01:54

I have an application that runs an activity with a service in a separate process that is started and bound to the activity. The service contains a handler that posts a runn

相关标签:
2条回答
  • 2021-01-18 02:28

    Also check the multiprocess flag of the content provider in the manifest. Each process would have a separate connection to the database.

    0 讨论(0)
  • 2021-01-18 02:34

    Are you possibly accessing the database using multiple SQLiteDatabase (or perhaps SQLiteOpenHelper) instances?

    You can only have one connection to the database otherwise you'll get the errors you've experienced.

    SQLiteDatabase itself is thread safe, so you can access it concurrently.

    0 讨论(0)
提交回复
热议问题