title: android can't open sqlite database from assets folder
body: <p>i have one .sqllite database file and i try to open this database and insert some values.but when i run application i have log cat error.can't open database
  this is a my code</p>
  
  <pre><code>public class IrocDBController extends SQLiteOpenHelper {
  
  String DB_PATH = null;
  private static String DB_NAME = "CredoDatabase.sqlite";
  private static String usm_Users = "Usm_Users";
  
  private SQLiteDatabase myDataBase;
  
  private final Context myContext;
  public IrocDBController(Context context) {
  
      super(context, DB_NAME, null, 2);
      this.myContext = context;
      DB_PATH = "/data/data/" + context.getPackageName() + "/" + "databases/";
  }
  public void InsertToLoginTable(String username, String password,
          String LoanOfficerId, String BranchId) {
      ContentValues newValues = new ContentValues();
      newValues.put("UserName", username);
      newValues.put("Password", password);
      newValues.put("LoanOfficerId", LoanOfficerId);
      newValues.put("BranchId", BranchId);
  
      myDataBase.insert(usm_Users, null, newValues);
  }
  
  
  public boolean DublicateValues(int LoanOfficerId) {
      myDataBase = this.getWritableDatabase();
      Cursor cursor = myDataBase.rawQuery("select * from " + usm_Users + " where "
              + "LoanOfficerId" + " == " + LoanOfficerId, null);
      boolean exists = (cursor.getCount() &gt; 0);
      Log.e("aaaaaaaaaaaaaaaaaaaa", String.valueOf(cursor.getCount()));
      cursor.close();
      return exists;
  }
  
  public void createDataBase() throws IOException {
      boolean dbExist = checkDataBase();
      if (dbExist) {
          // do nothing - database already exist
      } else {
          this.getReadableDatabase();
          try {
              copyDataBase();
          } catch (IOException e) {
              throw new Error("Error copying database");
  
          }
      }
  
  }
  
  public String getNameFildeEntry(String username) {
      Cursor cursor = myDataBase.query(usm_Users, null, " UserName=?",
              new String[] { username }, null, null, null);
      if (cursor.getCount() &lt; 1) // UserName Not Exist
      {
          cursor.close();
          return "NOT EXIST";
      }
      cursor.moveToFirst();
      String getUserName = cursor
              .getString(cursor.getColumnIndex("UserName"));
  
      cursor.close();
      return getUserName;
  }
  
  public String getPasswordFildeEntry(String Password) {
      Cursor cursor = myDataBase.query(usm_Users, null, " Password=?",
              new String[] { Password }, null, null, null);
      if (cursor.getCount() &lt; 1) // UserName Not Exist
      {
          cursor.close();
          return "NOT EXIST";
      }
      cursor.moveToFirst();
      String getUserPassword = cursor.getString(cursor
              .getColumnIndex("Password"));
  
      cursor.close();
      return getUserPassword;
  }
  
  
  private boolean checkDataBase() {
      SQLiteDatabase checkDB = null;
      try {
          String myPath = DB_PATH + DB_NAME;
          checkDB = SQLiteDatabase.openDatabase(myPath, null,
                  SQLiteDatabase.OPEN_READWRITE);
      } catch (SQLiteException e) {
      }
      if (checkDB != null) {
          checkDB.close();
      }
      return checkDB != null ? true : false;
  }
  
  
  private void copyDataBase() throws IOException {
  
      InputStream myInput = myContext.getAssets().open(DB_NAME);
      String outFileName = DB_PATH + DB_NAME;
      OutputStream myOutput = new FileOutputStream(outFileName);
      byte[] buffer = new byte[1024];
      int length;
      while ((length = myInput.read(buffer)) &gt; 0) {
          myOutput.write(buffer, 0, length);
      }
      myOutput.flush();
      myOutput.close();
      myInput.close();
  }
  
  public void openDataBase() throws SQLException {
  
  
      String path = DB_PATH + DB_NAME;
      myDataBase = SQLiteDatabase.openDatabase(path, null,
              SQLiteDatabase.OPEN_READWRITE);
  }
  
  @Override
  public synchronized void close() {
      if (myDataBase != null)
          myDataBase.close();
      super.close();
  }
  
  
  
  @Override
  public void onCreate(SQLiteDatabase db) {
  
  }
  
  @Override
  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>i use nativec tu create sqlite database and in my database i created some tables and etc and this database i inserted in assets folder
  i have no idea what am i doing wrong.
  if anyone knows solution please help me
  this is a my log cat error code
  <img src="https://i.stack.imgur.com/ZEdlb.png" alt="enter image description here"></p>