android - To close or not to close? -
in last days i'v got many error messages because of database leak in application, open database, query results , close db again.
but use cursoradapter autocompletetextview.
should on way there: open db, cursor, close db?!
i mean, haven't got problems because of not doing that, ...
so need tips experts, tips you
you should able open database in oncreate method , close in ondestroy method. guarantee available long activity "alive" , cleaned eventually.
further, should use "startmanagingcursor" on cursor use adapter. make sure deactivated, requeried, , closed necessary on pause, resume, , destroy respectively. cursors aren't used in adapters should closed finished getting data them.
there should no leaks if follow these rules.
Comments
Post a Comment