karimi72
جمعه 07 آذر 1393, 11:02 صبح
دوستان من یک فایل دیتا بیس از پیش ساخته شده را در assets قرار دادم و نامش هست mydb.sql حال می خواهم داده های موجود در این دیتا بیس را بخوانم :
برنامه من وقتی به این بخش می رسد FileNotFoundException تولید می کند.
try {
String destPath = "/data/data/" + getPackageName() + "/databases/MyDB";
File f = new File(destPath);
if (!f.exists()) {
CopyDB( getBaseContext().getAssets().open("mydb"),
new FileOutputStream(destPath));
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
DBAdapter database=new DBAdapter(this);
برنامه من وقتی به این بخش می رسد FileNotFoundException تولید می کند.
try {
String destPath = "/data/data/" + getPackageName() + "/databases/MyDB";
File f = new File(destPath);
if (!f.exists()) {
CopyDB( getBaseContext().getAssets().open("mydb"),
new FileOutputStream(destPath));
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
DBAdapter database=new DBAdapter(this);