Quantcast
Channel: Android Database Access Across Tabs - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by Seva Alekseyev for Android Database Access Across Tabs

$
0
0

You're trying to open the database several times. Use a single ReportDatabase object, available via a static method ReportDatabase. Something like this:

class ReportDatabase{    static ReportDatabase TheDatabase = null;    static ReportDatabase Open(Context c)    {        if(TheDatabase == null)            TheDatabase = new ReportDatabase(c);        return TheDatabase;    }}

This is often called a singleton. Or a global :)


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>