2014-05-12 1 views
0

안녕하세요. SQLite 등이있는 애플리케이션 디렉토리에 캡처 한 사진을 저장하고 싶습니다. SD 카드에 폴더와 숨겨진 파일을 만들고 싶지 않습니다. 캡처 한 사진을 응용 프로그램 디렉토리에 저장하는 방법.캡처 한 사진을 Android의 애플리케이션 디렉토리에 저장하는 방법

나는 이것을 아래에서 시도하고 있지만 숨겨진 파일 인 SD 카드에 저장하고 있지만이 방법은 원하지 않습니다.

Intent cameraIntent = new Intent(
     android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
String capturedPhotoName = "." + System.currentTimeMillis() + ".png"; 
File photo = new File(Environment.getExternalStorageDirectory(), 
     capturedPhotoName); 
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo)); 
imageUri = Uri.fromFile(photo); 
startActivityForResult(cameraIntent, CAMERA_INTENT_REQUEST); 

미리 감사드립니다.

답변

3

에서

userPic 저장
byte[] UserPic = null; 
UserPic = Base64.decode(result.getData(), 0); 

의 최대 크기 란이 위치

/data/data/com.your.packagename/app_data/imageDir 
+0

에 저장합니다 응용 프로그램 스토리지에

public Uri setImageUri() { ContextWrapper cw = new ContextWrapper(getApplicationContext()); File directory = cw.getDir("imageDir", Context.MODE_PRIVATE); File file = new File(directory,System.currentTimeMillis() + ".png"); Uri imgUri = Uri.fromFile(file); this.imgPath = file.getAbsolutePath(); return imgUri; } 

이미지를 캡처 한 이미지를 저장하려면이 방법을 시도 응용 프로그램의'cacheDir'? 큰 크기의 여러 파일을 저장하면 문제가 발생하지 않습니까? –

+0

문서에 선언 된 픽스 크기는 장치 내부 저장소에 따라 다릅니다 –

+0

oh 장치 내부 저장소가 16GB이면 캐시 크기는 무엇입니까? –

-1

fromActivityResult()에서 URI를 가져 와서이를 데이터베이스의 바이트 저장 바이트로 변환합니다. 데이터베이스

관련 문제