Quantcast
Viewing latest article 1
Browse Latest Browse All 2

Answer by Seva Alekseyev for Android Database Access Across Tabs

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 latest article 1
Browse Latest Browse All 2

Trending Articles



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