louiscad
01/16/2018, 8:08 AMmaplonki
01/16/2018, 5:31 PMlouiscad
01/16/2018, 6:47 PM.use { … }
inside a ContentProvider because it closes the database afterwards, making it unusable from the returned Cursor
. Just get a readable or writable reference to your db, and let Android close it when your app is killed by the system (like done for all ContentProviders)maplonki
01/16/2018, 6:48 PMlouiscad
01/16/2018, 6:51 PMContentProvider
is always available (the system wakes (starts) your app up if it's exported and another app requests access to it), but is not consuming CPU cycles when not used. However, the database remains open while your app is loaded into RAM, yesmaplonki
01/16/2018, 8:21 PM