title: How should I notify the user that SQLite Asset Helper is loading the database for the first time?
body: <p>I'm using the <a href="https://github.com/jgilfelt/android-sqlite-asset-helper" rel="noreferrer">SQLite Asset Helper</a> library to handle the dirty work of setting up and upgrading my app's database. It works really well but unfortunately I have yet to figure out a way to notify the user when the library:</p>
  
  <p>A) loads the database for the first time (by unzipping it from the \assets\databases\ folder)</p>
  
  <p>or</p>
  
  <p>B) upgrades the database (using information in an upgraded database file in \assets\datates)</p>
  
  <p>I tried putting this code in my app's main Activity.onCreate(), thinking I could load the database (if it didn't exist) on the main thread while distracting the user with a un-dismiss-able AlertDialog:</p>
  
  <pre><code>    File dbFile=this.getDatabasePath("gShoJMDict");
      Boolean dbExists = dbFile.exists();
      Log.i("ActivityStartScreen", String.valueOf(dbExists));
  
      if(!dbExists)
      {
          DialogFirstRun dialogFirstRun = new DialogFirstRun();
          dialogFirstRun.show(getSupportFragmentManager(), "dialogFirstRun");
          dialogFirstRun.setCancelable(false);
          DictHelper helper = new DictHelper(this);
          helper.getReadableDatabase();
          helper.close();
          dialogFirstRun.dismiss();
      }
  </code></pre>
  
  <p>Unfortunately it appears (based on LogCat entries) that SQLite Asset Helper checks to see if the database exists well before onCreate(), so by the time the above chunk of code runs, the database already exists so the dialog never shows up.</p>
  
  <p>I'm using a ContentProvider, and I've verified that I'm only calling getReadableDatabase() from within query() or update(). My ContentProvider's onCreate() looks like this...</p>
  
  <pre><code>@Override
  public boolean onCreate()
  {
      // Load our database
      gdb = new JMDictHelper(getContext());
      return true;
  }
  </code></pre>
  
  <p>...but despite moving <strong>gdb = new JMDictHelper(getContext());</strong> into query() or update(), SQLite Asset Helper library still loads the database well before I can notify the user.</p>
  
  <p>What can I do in this situation to intercept the initial setup or upgrade of the database and notify the user that the app is busy performing these tasks? Right now the app just sits there doing nothing until the library finishes - that's fine for testing since I know to expect it, but I can't leave it like that when I'm ready for the app to go live.</p>