1. 程式人生 > >Android SQLite是執行緒安全的嗎?

Android SQLite是執行緒安全的嗎?

我們操作資料庫一般使用ContentProvider,SQLiteOpenHelper,應用中使用SQLiteDatabase db = SQLiteOpenHelper.getReadableDatabase(),這個db需要呼叫db.close()或者openHelper.close()方法嗎?

不需要。

A content provider is created when its hosting process is created, and remains around for as long as the process does, so there is no need to close the database – it will get closed as part of the kernel cleaning up the process’s resources when the process is killed.