안드로이드 개발 질문/답변
(글 수 45,052)
안녕하세요
화면을 캡쳐해서 bitmap으로 변환했는데요
이 bitmap을 파일로 저장하고싶거든요
try {
FileOutputStream out = new FileOutputStream("/sdcard/captureScreen.png");
srcimg.compress(Bitmap.CompressFormat.PNG, 100, out);
} catch (FileNotFoundException e) {
}
그래서 이렇게 했는데 프로그램이 종료되거나 그러지않아요
정상적으로 작동은하는데 저장이 안되네요-_-;
제가 잘못한건가요??
bitmap을 파일로 저장하는 다른방법이 있을까요?
화면을 캡쳐해서 bitmap으로 변환했는데요
이 bitmap을 파일로 저장하고싶거든요
try {
FileOutputStream out = new FileOutputStream("/sdcard/captureScreen.png");
srcimg.compress(Bitmap.CompressFormat.PNG, 100, out);
} catch (FileNotFoundException e) {
}
그래서 이렇게 했는데 프로그램이 종료되거나 그러지않아요
정상적으로 작동은하는데 저장이 안되네요-_-;
제가 잘못한건가요??
bitmap을 파일로 저장하는 다른방법이 있을까요?
2010.02.24 23:29:46
File copyFile = new File(path);
OutputStream out = null;
try {
copyFile.createNewFile();
out = new FileOutputStream(copyFile);
if ( bit.compress(CompressFormat.JPEG, 70, out) )
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
OutputStream out = null;
try {
copyFile.createNewFile();
out = new FileOutputStream(copyFile);
if ( bit.compress(CompressFormat.JPEG, 70, out) )
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}