SQLiteConnection was leaked!

A SQLiteConnection object for database '/data/data/.../databases/....db' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed

获取数据库对象改成单例模式,项目运行中只保证唯一一个对象即可。


public class TestDbHelper extends SQLiteOpenHelper {
    private static TestDbHelper instance;
    TestDbHelper(Context context) {
    (context, CommonUtilities., , );
    }

TestDbHelper getInstance(Context context) {
        (== ) {
            (TestDbHelper.) {
                (== ) {
                    = TestDbHelper(context.getApplicationContext());
                }
            }
        }
        ;
    }
}




你可能感兴趣的:(SQLiteConnection was leaked!)