The solution I found, was by putting your db file inside of assets folder. Instead of reading a .csv file to create a .db file ( when you start the proper activity) firstly try to check if the .db file is in /data/data/file.db, if it isn't, copy it from your assets folder to that path. With the next code you will be able to make all:
protected void copyDataBase() throws IOException {
//Open your local db as the input stream
InputStream myInput = getApplicationContext().getAssets().open("file.db");
// Path to the just created empty db
String outFileName = "/data/data/com.yourpackagename/databases/" + "file.db";
//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))>0){
myOutput.write(buffer, 0, length);
}
//Close the streams
myOutput.flush();
myOutput.close();
myInput.close();
}
protected boolean checkDataBase(){
SQLiteDatabase checkDB = null;
try{
String myPath = "/data/data/com.yourpackage/databases/" + "file.db";
checkDB = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);
}catch(SQLiteException e){
//database does't exist yet.
}
if(checkDB != null){
checkDB.close();
}
return checkDB != null ? true : false;
}