사진을 찍어 SD 카드에 저장할 수있는 Android 앱을 작성 중입니다. 나중에 GridView에 그림을 표시해야하며 사용자가 선택할 수 있습니다. 이것은 내 그림을 저장하는 코드입니다.저장된 이미지를 mediastore에 추가하고 축소판을 생성하는 방법은 무엇입니까?
Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() {
@Override
public void onPictureTaken(byte[] data, Camera c) {
currentPictureName = (String) getResources().getText(R.string.username)
+ System.currentTimeMillis() + ".jpg";
FileOutputStream outStream = null;
try {
outStream = new FileOutputStream(sdcardPath + currentPictureName);
outStream.write(data);
outStream.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
mCamera.startPreview();
}
}
그러나 저장된 이미지에는 GridView에 축소판 그림이 표시되지 않습니다. 저장 한 모든 이미지의 축소판 그림을 자동으로 생성하고 나중에 액세스 할 수 있도록 MediaStore
에 모든 것을 추가하려면 어떻게합니까?
감사합니다.이 또한 http://www.mail-archive.com/[email protected]/msg63884.html 시도 중입니다. –
'scanFile()'도 자동으로 미리보기 이미지를 생성합니까? –
예, 그렇게 생각합니다. –