AssetManager manager = mContext.getAssets();
String folderPath = "/data/data/" + "com.ac.aaa" + "/databases";
String filePath = "/data/data/" + "com.ac.aaa" + "/databases/"
+ "LottoLocation.db";
File folder = new File(folderPath);
File file = new File(filePath);
FileOutputStream fos = null;
BufferedOutputStream bos = null;
try {
File path = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "test.db");
FileInputStream fis = new FileInputStream(path);
BufferedInputStream bis = new BufferedInputStream(fis);
if (folder.exists()) {
} else {
folder.mkdirs();
}
if (file.exists()) {
file.delete();
file.createNewFile();
}
fos = new FileOutputStream(file);
bos = new BufferedOutputStream(fos);
int read = -1;
byte[] buffer = new byte[1024];
while ((read = bis.read(buffer, 0, 1024)) != -1) {
bos.write(buffer, 0, read);
}
bos.flush();
bos.close();
fos.close();
bis.close();
fis.close();
} catch (IOException e) {
Log.e("ErrorMessage : ", e.getMessage());
}
제가 지금 위의 소스대로 하였는데요.. 디비가 생성은 되는데 데이터 복사가 이루어 지지를 않네요..ㅠㅠ 왜 그런 걸까요
sd카드에 있는 파일이 안불러 와져서 그런 건가요?




소스가 의미하는게 좀 모허한거 같은데요 아니면 제가 이해를 못하고 있든지요..ㅎ
1. AssetManager 를 통해서 하는 일이 없다..
2. /data/data/ 영역에 파일에 복사를 해서 넣을것인가?
3. Environment.getExternalStorageDirectory().getAbsolutePath() + "test.db" 즉 sdcard 에 test.db 가 존재하는가?
4. 권한 Permission은 충분조건인가?