I am using this to get my File located in src folder src/file1.txt
InputStream is = openFileInput(\"file1.txt\");
and using BufferedReader to R
Your src folder doesn't and won't exist on your emulator or device; it only exists on your host machine. If you want to read in a file delivered with your app, put it in either your raw or assets folder.
can try this code...................................
String packageName = context.getPackageName();
DB_PATH = "/data/data/" + packageName + "/databases/";
path=DB_PATH+DB_PATH;
private void copyDatabase() {
try {
InputStream dbInputStream = context.getAssets().open(DB_NAME);//Read data..........
String path = DB_PATH + DB_NAME;
OutputStream dbOutputStream = new FileOutputStream(path);// write data............
byte[] buffer = new byte[4096];
int readCount = 0;
while ((readCount = dbInputStream.read(buffer)) > 0) {
dbOutputStream.write(buffer, 0, readCount);
}
dbInputStream.close();
dbOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}