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

后端 未结 2 1615
没有蜡笔的小新
没有蜡笔的小新 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: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.

提交回复
热议问题