Showing posts with label asynctaskloader. Show all posts
Showing posts with label asynctaskloader. Show all posts

Monday, March 5, 2012

How should a SQLiteDatabase connection be handled inside an AsyncTaskLoader?


I wondering where and when I should open/close my SQLiteDatabase connection in my AsyncTaskLoader. I don't feel like i fully understand the lifecycle of a Loader, so I'm afraid that I might run into some memory leaks/NullPointerExceptions if I don't to this right. I currently open up my SQLiteDatabase in the constructor of my loader:

How should a SQLiteDatabase connection be handled inside an AsyncTaskLoader?


I wondering where and when I should open/close my SQLiteDatabase connection in my AsyncTaskLoader. I don't feel like i fully understand the lifecycle of a Loader, so I'm afraid that I might run into some memory leaks/NullPointerExceptions if I don't to this right. I currently open up my SQLiteDatabase in the constructor of my loader: