Detailed exception:
A sqliteconnection object for database '/data/data/.../databases/....db ' was leaked! Fix your application to end transactions in progress properly and to close the database when it is no longer needed
The database operation is obviously abnormal, the database object is locked, explicitly telling you that the object is not needed to close for long.
Correct: Get the database object into singleton mode, only one object can be guaranteed in the project running. As follows:
private static Xxxxsqlhelper minstance = null;
Public synchronized static Xxxxsqlhelper getinstance (context context) {
if (minstance = = null) {
Minstance = new Xxxxsqlhelper (context);
}
return minstance;
};
The call is as follows:
Public Xxxxdbutil (Context context) {
Msqlitedatabase = xxxxsqlhelper.getinstance (context)
. Getwritabledatabase ();
}
Note: The database object is a unique instance at this point, no close is required, and if close is dropped, a critical exception will occur that the object is closed, causing the program to crash.
Excerpt from: http://www.cnblogs.com/jiuzhexingfu/p/3872712.html
A sqliteconnection object for database '/data/data/.../databases/....db ' was leaked!