title: [Android]SQLite DB cannot be accessed from others activities than one
body: <p>I'm facing some issues with my SQLite Database. I have about 5activities in my application, but i can access to it from only one activity. 
  On this activity, i can fully use my DB and do all i want to.</p>
  
  <p>On other activities, i cannot use it. I get an empty DB.</p>
  
  <p>Of course, i use the same code to access my DB, regardless of the activity.</p>
  
  <p>I use a homemade class to access the DB, derivated from SQLiteOpenHelper, and another class to manipulate the first one. The DB is downloaded from an online server into the "/data/data/com.example.btc_pe/databases/" folder.</p>
  
  <p>My first class, to access the DB.</p>
  
  <pre><code>public final class BtcDb extends SQLiteOpenHelper
  { 
      public BtcDb(Context context, String name, CursorFactory factory, int version) 
      {
          super(context, name, factory, version);
      }
  
      @Override
      public void onCreate(SQLiteDatabase db)
      {   
          // TODO Auto-generated method stub
          Log.d("BTC","Db created");
      }
  
      @Override
      public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
      {
          // TODO Auto-generated method stub
          //db.execSQL("DROP TABLE "+ TABLE_PRODUITS +";");
          //onCreate(db);
      }
  
  }
  </code></pre>
  
  <p>And my manipulation class :</p>
  
  <pre><code>public final class DbHelper
  {
      public static int version=1;
      private static final String nomDb="basesqlite.db";
  
      private int num_id=0;
      private int num_tension=1;
      private int num_typeRacc=2;
      private int num_nbCond=3;
      private int num_technique=4;
      private int num_typeConn=5;
      private int num_conn=6;
      private int num_desiConn=7;
      private int num_refProd=8;
      private int num_desiProd=9;
      private int num_diamMin=10;
      private int num_diamMax=11;
      private int num_section=12;
      private int num_diamConnMax1=13;
      private int num_diamConnMax2=14;
      private int num_diamConnMax3=15;
      private int num_diamConnMax4=16;
      private int num_diamConnMax5=17;
  
      private String tableProduits = "produit";
  
      private SQLiteDatabase bdd;
      private BtcDb btcDb1;
  
      public DbHelper(Context context)
      {
          btcDb1=new BtcDb(context,nomDb,null,version);
      }
  
      public void open()
      {
          bdd=btcDb1.getReadableDatabase();
      }
      public void close()
      {
          bdd.close();
      }
      public SQLiteDatabase getBdd()
      {
          return bdd;
      }   
  
      public int getCountDb()
      {
          Cursor c = bdd.rawQuery("SELECT COUNT(*) FROM"+ tableProduits, null);
  
          return cursorToCount(c);
      }   
  
      public int cursorToCount(Cursor c)
      {
          c.moveToFirst();
          int i=c.getInt(0);
  
          return i;
      }
  }
  </code></pre>
  
  <p>In my activity, I have to instanciate the DBHelper Class, which instanciate BtcDB. 
  So all I should have to do is this :</p>
  
  <pre><code>DBHelper dbHelper1 = new DBHelper(this);
  dbHelper1.open();
  //Manipulation of the DB
  int i=dbHelper1.getCountDB(); //In example...
  Log.d("BTC","DB Count : "+i);
  //Other manipulations of the DB.
  dbHelper1.closer(); 
  </code></pre>
  
  <p>As i said, it works pretty well on one of my activities but not on the others.</p>
  
  <p>I'm pretty lost here ^^".</p>