Closing the database in a ContentProvider

According to Dianne Hackborn (Android framework engineer) there is no need to close the database in a content provider.

A content provider is created when its hosting process is created, and
remains around for as long as the process does, so there is no need to
close the database — it will get closed as part of the kernel
cleaning up the process’s resources when the process is killed.

Thanks @bigstones for pointing this out.

Leave a Comment