0
내가 의도갤러리 반환 된 파일 이름
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(Intent.createChooser(intent, "Select Media"), CameraUtils.REQUEST_GALLERY);
내가 얻을 결과를 전송하고 이전 파일 이름 /mnt/sdcard/DCIM/100LGDSC/CAM00046.jpg이었다 파일
case CameraUtils.REQUEST_GALLERY:
Uri uri = data.getData();
ContentResolver cr = this.getContentResolver();
String fileName = FileUtils.getPath(this, uri);
File from = new File(fileName);
String directory = from.getParent();
File to = new File(directory, "newFile" + i + ".jpg");
from.renameTo(to);
i++;
의 이름을 바꾸려면 새 파일 이름은 "/mnt/sdcard/DCIM/100LGDSC/newFile1.jpg"입니다. 그런 다음 다시 Intent를 보내고 동일한 파일을 가져 오지만 파일 이름은 "/mnt/sdcard/DCIM/100LGDSC/newFile1.jpg"가 아니라 "/mnt/sdcard/DCIM/100LGDSC/CAM00046.jpg"입니다. 왜? 프로그램에 코드를 아래에 추가 :이 작품은
, 어쩌면 그들이 업데이트 할 수 있습니다
코드가 같은 것인가? – user1528799