Create DAO inside Application object
Many Android API methods require Context object parameter, you could pass Activity or Application for that, but in case of any kind of data communication it would be much safer to use Application context.
Plenty of memory issues exists because developers keep references to Activity context inside theirs DAOs, this was Activity cannot be removed from memory when needed.
Written by Iwo Polański
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Android
Authors
Related Tags
#android
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#