I have no solid background of synchronization. I think this issue will be fixed when I use synchronized method. But can anyone help me to fix this issue? Code is be
You should not close the DB since it will be used again in the next call. So try to remove the
db.close();
from your code.
According to Dianne Hackborn (Android framework engineer) there is no need to close the database in a content provider
A content provider is created when its hosting process is created, and remains around for as long as the process does, so there is no need to close the database it will get closed as part of the kernel cleaning up the process's resources when the process is killed.
So there is no need to close the database . it will automatically close when it is not needed.