我知道这有许多不同的方式,但我似乎无法从默认文件夹中删除图库图像.我正确地将文件保存到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", …Run Code Online (Sandbox Code Playgroud) 我在用户的SD卡上保留了一些png文件.一些用户报告这些图像显示在他们的图库应用程序中.听起来像某些设备上的库实现搜索出他们可以在SD卡上找到的任何图像文件并在库中显示它.有没有办法告诉系统不要在库中包含这些图像?这对用户来说只是一种烦恼.
谢谢
我正在使用原生Android相机并将文件保存到我的应用程序数据文件夹(/mnt/sdcard/Android/data/com.company.app/files/Pictures/).同时,其他照片副本保存到DCIM文件夹.
这是我的代码:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
String formattedImageName = getDateString() + ".jpg";
File image_file = new File(this.getExternalFilesDir(Environment.DIRECTORY_PICTURES), formattedImageName);
Uri imageUri = Uri.fromFile(image_file);
intent.putExtra(MediaStore.EXTRA_OUTPUT,imageUri);
startActivityForResult(intent, REQUEST_FROM_CAMERA);
Run Code Online (Sandbox Code Playgroud)
如何防止将其他图像副本保存到DCIM文件夹?
非常感谢
android native android-sdcard android-camera android-camera-intent