Should the Notepadv3 tutorial close its database?

Androids Tutorial Notepad Notepadv3 opens its database, but never closes it explicitly. To make it correct, should Notepadv3 close its database, presumably with mDbHelper.close();and, if so, where should this line of code look?

Updated with a related question . > . Would it be equally effective to implement a close method through ? In other words, the close method of SQLiteDatabase is equivalent to the method of closing SQLiteOpenHelper , and if not, why is one preferable to the other?
mDb.close()

+3
source share
1 answer

Yes, you must close the adapter and cursors when you no longer need them (for example, when you finish your activity). This should be done according to the method onDestroy.

+3
source

All Articles