title: Android change database path issue
body: <p>I have a little problem with changing the path of my database in my custom <code>databaseHelper.class</code>. So in the beginning I put the database in default database folder in Internal Storage, but now I want to place it in <code>files/documents/users/servername/data</code>, but when I change the string which initialize my storage path the database which is placed there is empty. I forgot to mention that actually I have the sqlite file in my application's asset folder and I'm copying the file from there to my internal memory. So here is a piece of the code which I'm using :</p>
  
  <pre><code>private static final int DATABASE_VERSION = 1;
  private static String DB_PATH_PREFIX = "/data/data/";
  private static String DB_PATH_SUFFIX = "/databases/";
  
  public UserDatabaseHelper(Context context,  // String dbname,
                  CursorFactory factory, int version) {
          super(context,"stampii_tpl.sqlite", factory, version);
          this.context = context;
          Log.i(TAG, "Create or Open database : " + "stampii_tpl.sqlite");
  }
  
  private static void copyDataBase(Context aContext)
                  throws IOException {
  
          // Open your local db as the input stream
          InputStream myInput = aContext.getAssets().open("stampii_tpl.sqlite");
  
          // Path to the just created empty db
          String outFileName = getDatabasePath(aContext);
  
          Log.i(TAG, "Check if create dir : " + DB_PATH_PREFIX
                          + aContext.getPackageName() + DB_PATH_SUFFIX);
  
          // if the path doesn't exist first, create it
          File f = new File(DB_PATH_PREFIX + aContext.getPackageName()
                          + DB_PATH_SUFFIX);
          if (!f.exists())
                  f.mkdir();
  
          Log.i(TAG, "Trying to copy local DB to : " + outFileName);
  
          // Open the empty db as the output stream
          OutputStream myOutput = new FileOutputStream(outFileName);
  
          // transfer bytes from the inputfile to the outputfile
          byte[] buffer = new byte[1024];
          int length;
          while ((length = myInput.read(buffer)) &gt; 0) {
                  myOutput.write(buffer, 0, length);
          }
  
          // Close the streams
          myOutput.flush();
          myOutput.close();
          myInput.close();
  
          Log.i(TAG, "DB (" + "stampii_tpl.sqlite" + ") copied!");
  }
  private static boolean checkDatabase(Context aContext) {
          SQLiteDatabase checkDB = null;
  
          try {
                  String myPath = getDatabasePath(aContext);
  
                  Log.i(TAG, "Trying to conntect to : " + myPath);
                  checkDB = SQLiteDatabase.openDatabase(myPath, null,
                                  SQLiteDatabase.OPEN_READONLY);
                  Log.i(TAG, "Database " + "stampii_tpl.sqlite" + " found!");
                  checkDB.close();
          } catch (SQLiteException e) {
                  Log.i(TAG, "Database " + "stampii_tpl.sqlite" + " does not exists!");
  
          }
  
          return checkDB != null ? true : false;
  }
  
  @SuppressWarnings("unused")
  private static String getDatabasePath() {
          return getDatabasePath(context);
  }
  
  private static String getDatabasePath(Context aContext) {
          return DB_PATH_PREFIX + aContext.getPackageName() + DB_PATH_SUFFIX
                          + "stampii_tpl.sqlite";
  }
  </code></pre>
  
  <p>And if I try to change the <code>DB_PATH_SUFFIX</code> to : <code>/files/documents/users/servername/data</code> the database which I have there is empty and don't have the tables which are created in the file from assets folder.</p>
  
  <p>So any idea how to fix that? </p>