vendredi 20 mars 2015

Connection pool has been closed in Sqlite Azure Mobile Service SDK

In my Android project i use Azure Mobile Services SDK and the way i make queries to the local sqlite database is like the following: (example taken from http://ift.tt/1wryU1l).


The problem is that i get the following errors: "Connection pool has been closed", "A SQLiteConnection object for database 'LocalDatabase' was leaked! Please fix your application to end transactions in progress properly and to close the database when it is no longer needed", "Attempt to re-open an already-closed object".



new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
try {
final MobileServiceList<ToDoItem> result = mToDoTable.where().field("complete").eq(false).execute().get();
runOnUiThread(new Runnable() {
@Override
public void run() {
mAdapter.clear();

for (ToDoItem item : result) {
mAdapter.add(item);
}
}
});
} catch (Exception exception) {
createAndShowDialog(exception, "Error");
}
return null;
}
}.execute();


In this implementation there is no Cursor or SQLiteOpenHelper object to close. What could i do?


Thank you!


Aucun commentaire:

Enregistrer un commentaire