title: getWritableDatabase returns null
body: <p>I have Android service, that uses SQLite database. I faced some troubles with database initialization.</p>
  
  <p>I have class DBHelper:</p>
  
  <pre><code>public class DBHelper extends SQLiteOpenHelper{
  public boolean db_loaded=false;
  public DBHelper() {
      super(ContextBean.getLocalContext(), "resplugin1.db", null, 1);
  }
  @Override
  public void onCreate(SQLiteDatabase db) {
      db.execSQL("create table tasks ("
              + "id integer primary key autoincrement,"
              + "title text);");
      db_loaded=true;
  }
  </code></pre>
  
  <p>I have client class that uses it:</p>
  
  <pre><code>public class DataProvider {
  private SQLiteDatabase database;
  private DBHelper dbHelper;
  
  public DataProvider(){
      dbHelper=new DBHelper();
      database = dbHelper.getWritableDatabase();
  }
  public void close(){
      dbHelper.close();
  }
  public TaskDescriptor getTaskById(int id){
      while(dbHelper.db_loaded==false){}
      String[] args={Integer.toString(id)};
      if(database==null){
          Log.d("ResPluginService1","DATABASE IS NULL");
      }
  /*...*/
  }
  </code></pre>
  
  <p>The problem is that database object is always <strong>NULL</strong>. 
  <em>getWritableDatabase</em> method throws no exceptions, it just returns null. What can cause so strange behaviour?</p>