Activity Life Cycle And Database
I have an application that reads values from a Database table (Database is named SoftCopyDatabase) and populates a List with the values read from Database. On clicking an item from
Solution 1:
Here is a good article covering the topic:
http://awiden.wordpress.com/2010/03/26/database-mangement-and-the-activity-lifecycle/
Solution 2:
That's normal because both methods are executed... just do this on both methods (onDestroy
and onStop
):
if(lectures.isOpen()){
lectures.close();
}
Although I think you can just put a .close
invokation in one of them. Make sure to create the isOpen
method in your SoftCopyDatabase
class which must call the SqliteDatabase
object's isOpen
method.
Post a Comment for "Activity Life Cycle And Database"