SQLite unable to open database file (code 14) on frequent “SELECT” query

后端 未结 5 781
無奈伤痛
無奈伤痛 2020-12-16 04:09

I have following class \"Singleton\" to handle SQLite connection and to make sure to have 1 instance of connection for whole process/app:

public class DBCon         


        
5条回答
  •  攒了一身酷
    2020-12-16 04:42

    Your code re-opens the database every time dbOpen() is called.

    An SQLite database object is quite lightweight; it does not really make sense to keep closing and re-opening it.

    You already have your singleton; just store a single SQLiteDatabase reference there.

提交回复
热议问题