Hi,
My app contains a sqlite db that will be opened by the end user.
So far I have tried an approach I have found to place the text file in the resources/raw. From there I will read it and generate the db.
I am wondering though, is there an easier approach?
With this approach I am pursuing, so far I am running into the issue that the exception is kicking in, rather than the file being displayed. The file is in the resources.ap_ though.
private void readFileFromLocal( Context context )
{
InputStream istream = null;
try {
istream = context.getResources().openRawResource(R.raw.out2);
String s;
int i;
istream.read(b, 0,100);
s = b +"";
Log.i("msg",s);
} catch (Exception FileNotFoundException){
Log.v("File not found exception!", "hoy");
}
}
Is there some snippet out there that copies the SQLite db to resources/raw and from there it can be simply copied to the filessytem? I have found some methods under java.io.File: "mkdir", "create" and "rename" file, but not "copy":
String path2 = "/data/data/com.google.ha1/omar/";
File dir = new File(path2);
dir.mkdir();
File temp = File.createTempFile("mediaplayertmp",".txt", file);
temp.renameTo(filedest);
Many thanks for your help,

