拍摄相机意图后删除图库图像
我知道这有许多不同的方式,但我似乎无法从默认文件夹中删除图库图像。我正确地将文件保存到SD卡,我可以删除该文件,但在Camera文件夹下显示的默认图库文件不会删除。
我希望在返回活动后删除图像,因为文件已存储在SD卡下/Coupon2
。
有什么建议?
public void startCamera() { Log.d("ANDRO_CAMERA", "Starting camera on the phone..."); mManufacturerText = (EditText) findViewById(R.id.manufacturer); String ManufacturerText = mManufacturerText.getText().toString(); String currentDateTimeString = new Date().toString(); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); File filedir = new File(Environment.getExternalStorageDirectory()+"/Coupon2"); filedir.mkdirs(); File file = new File(Environment.getExternalStorageDirectory()+"/Coupon2", ManufacturerText+"-test.png"); outputFileUri = Uri.fromFile(file); intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); startActivityForResult(intent, CAMERA_PIC_REQUEST);}protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == CAMERA_PIC_REQUEST && resultCode == -1) { Intent intent = new Intent("com.android.camera.action.CROP"); intent.putExtra("crop", "true"); intent.putExtra("scale", "true"); intent.putExtra("return-data", false); intent.setDataAndType(outputFileUri, "image/*"); intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); startActivityForResult(intent, CAMERA_CROP_REQUEST); }else { SetImage(); saveState(); }}
MYYA
相关分类