我工作的一個項目,該項目採取的照片從用戶然後做一些image processing
。 ,我使用此代碼來捕獲用戶的照片:如何防止android相機意圖保存拍攝的圖像兩次?
private static final int TAKE_PICTURE = 1;
private Uri imageUri;
public void takePhoto(View view) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File photo = new File(Environment.getExternalStorageDirectory()+"/glasses/", "temp.png");
intent.putExtra(MediaStore.EXTRA_OUTPUT,
Uri.fromFile(photo));
imageUri = Uri.fromFile(photo);
startActivityForResult(intent, TAKE_PICTURE);
}
,它工作正常,但問題是照片中有兩個不同的目錄被保存兩次:
- /存儲/模擬/ 0/DCIM /相機
- /存儲/模擬/ 0 /眼鏡
如何防止相機從意向保存拍攝的圖像的相機基本目錄?
在此先感謝。
因爲您正在將圖片保存在您的代碼中。 –
@MuhammadTufail是的,我保存圖像做一些圖像處理,我想保存在一個目錄! –
一個目錄是指哪個目錄? – Champandorid