jeudi 21 avril 2016

Sqlite transaction not working from background thread

I have a function in which i have done some database operation and covered with database transaction as:

 public void myTransactionMethod()
{
    BeginTransaction();

    //Some database operations 

    SetTransactionSuccessful();
    EndTransaction();
}

This works fine when i call it from Activity(Main thread). But This is not working when i try to call this from thread which is in background service. I am getting this error SQLiteConnectionPool The connection pool for database has been unable to grant a connection to thread SQLiteConnectionPool(14004): Connections: 0 active, 1 idle, 0 available.

I don't have any pending transaction when calling from service thread and I am using single instance of DatabaseHelper throughout the application.

Please help me. Let me know if you need more information.

Aucun commentaire:

Enregistrer un commentaire