-1
내 앱의 아이디어는 카메라에서 이미지를 캡처 한 다음 지정된 영역을 자르는 것입니다.내 앱에서 사진 저장
문제 : 자른 이미지를 내 sd 카드에 처음 저장하면 앱이 제대로 저장됩니다. 하지만 한 번 더 내 앱을 실행하고 이미지를 찍은 다음 잘라냅니다. 저장하면 첫 번째 이미지는 현재 카드가 아닌 SD 카드에 나타납니다.
public static void save(Activity activity, Bitmap bm, String name) {
OutputStream outStream = null;
File externalFilesDir = activity.getExternalFilesDir(Environment.DIRECTORY_PICTURES);
File outFile = new File(externalFilesDir, "IDOCR" + File.separator + "Numbers");
if (!outFile.exists())
outFile.mkdirs();
File number = new File(outFile, name + ".PNG");
//if (number.exists())
// number.delete();
try {
//outStream = new FileOutputStream(new File(path));
outStream = new FileOutputStream(number);
bm.compress(Bitmap.CompressFormat.PNG, 100, outStream);
outStream.flush();
outStream.close();
bm.recycle();
System.gc();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
아니요, 이전에 시도했지만 작동하지 않았습니다. –
두 버전 모두 동일한 파일 이름을 사용하고 있습니까? 파일 이름을 변경하면 작동합니까? – Matthieu
예, 동일한 이름을 사용하고 있습니다. 이름 변경시 작동 중입니다. 하지만 나중에 작업 할 때마다 동일한 이름이 필요합니다. –