Do not hardcode /data/ use Context.getFilesDir().getPath()

// warning
private static String DB_PATH =  "/data/data/cz.okhelp.german_czech_phrases/databases/";
 
// OK
   public DataBaseHelper(Context context) {	 
    	super(context, DB_NAME, null, 1);
        this.myContext = context;
        // OK
         DB_PATH = context.getFilesDir().getParentFile().getPath()
              + "/databases/";
    }
This entry was posted in Android Examples Code, Bugs, warnings, errors, SQLite database and tagged , , . Bookmark the permalink.


Comments are closed.



9,486 views