raha_jon
شنبه 23 آبان 1394, 15:51 عصر
سلام و خسته نباشید من چند خط کد دارم .این کد ها در بعضی از مدل های گوشی کار میکنن و در دیگری نه!
و همین طور در شبیه ساز جنی موشین هم کار میکنه و در بلواستکس کار نمیکنه.
خواهشا راهنمای فرمایید.
AssetManager assetManager = A.con.getAssets();
InputStream in = null;
OutputStream out = null;
try {
in= assetManager.open("aa.db");
Log.i("tag", ""+in);
} catch (IOException e) {
e.printStackTrace();
}
File data = Environment.getDataDirectory();
String str1 = "/data/" + getPackageName() + "/databases/" + "aa.db";
File result = new File(data, str1);
try {
out = new FileOutputStream(result);
copyFile(in, out);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void copyFile(InputStream in, OutputStream out) throws IOException {
byte[] buffer = new byte[1024];
int read;
while ((read = in.read(buffer)) != -1) {
out.write(buffer, 0, read);
}
}
و همین طور در شبیه ساز جنی موشین هم کار میکنه و در بلواستکس کار نمیکنه.
خواهشا راهنمای فرمایید.
AssetManager assetManager = A.con.getAssets();
InputStream in = null;
OutputStream out = null;
try {
in= assetManager.open("aa.db");
Log.i("tag", ""+in);
} catch (IOException e) {
e.printStackTrace();
}
File data = Environment.getDataDirectory();
String str1 = "/data/" + getPackageName() + "/databases/" + "aa.db";
File result = new File(data, str1);
try {
out = new FileOutputStream(result);
copyFile(in, out);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void copyFile(InputStream in, OutputStream out) throws IOException {
byte[] buffer = new byte[1024];
int read;
while ((read = in.read(buffer)) != -1) {
out.write(buffer, 0, read);
}
}