androiddatabase-connectionandroid-2.2-froyoandroid-2.0-eclair

Android higher version issue


I have developed a tab-based application using API level 7. It is running fine with Android 2.1 device. But it is giving problem when I am trying to run it in 2.2 device. When I visit any tab first time, it is OK. But if the same tab is revisited, it is giving following error msg.

android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here

But no such problem in 2.1 device. Here I like to mention that I have closed the database connection in each of the activity of any tab.

More surprisingly, initially I am at tab A. For Tab A I have done some database operation. Then I go to tab B with no problem where also database operation is done with same database. Then if I come back to tab A, it is giving this error. If it is database and cursor closing related problem, it should give exception when I am going from tab A to B. Can anyone locate where is problem?


Solution

  • It is not at all tab related prob. In onCreate() there is a code-

    datePickerDialog = new DatePickerDialog(getParent(), ButtonTestDateListener,
                    mYear, mMonth, mDay);
    

    I have just declare the mYear, mMonth and mDay as Integer, but no initialization was there. It is working fine in 2.1, but giving prob in 2.2. Before that I have opened the database connection and not closed it. Thats why it is giving such problem.