title: Database not being copied from assets folder to device
body: <p>I have a .db file in my <code>assets</code> folder. I've copied it to the <code>data/data/&lt;packagename&gt;/databases/</code> folder in the emulator and its working fine..</p>
  
  <p>But when i run it on device it force closes. It is showing </p>
  
  <pre><code>SQLite exception: no such table: tbl_user
  </code></pre>
  
  <p>Here is my code..</p>
  
  <pre><code>public class DatabaseHelper extends SQLiteOpenHelper {
  
          public DatabaseHelper() {
  
              super(dataContext, DATABASE_NAME, null, 1);
  
              DB_PATH = "/data/data/"
                      + dataContext.getApplicationContext().getPackageName()
                      + "/databases/";
  
              Log.d("PATH", DB_PATH);
  
              boolean dbExist = checkDataBase();
              if (!dbExist) {
  
                  this.getReadableDatabase();
                  try {
                      copyDataBase();
  
                  } catch (IOException e) {
                      Log.d("Error", e.toString());
                  }
              }
  
          }
  
          private void copyDataBase() throws IOException {
              // TODO Auto-generated method stub
  
              InputStream inFile = dataContext.getAssets().open(DATABASE_NAME);
              String outFileName = DB_PATH + DATABASE_NAME;
              OutputStream myOutput = new FileOutputStream(outFileName);
              byte[] buffer = new byte[1024];
              int length;
              while ((length = inFile.read(buffer)) &gt; 0) {
                  myOutput.write(buffer, 0, length);
              }
              // Close the streams
              myOutput.flush();
              myOutput.close();
              inFile.close();
          }
  
          private boolean checkDataBase() {
              // TODO Auto-generated method stub
  
              File dbFile = new File(DB_PATH + DATABASE_NAME);
  
              return dbFile.exists();
  
          }
  </code></pre>
  
  <p>Should i have to do something else to copy that db to the device???</p>
  
  <p>Thanks..</p>