简体   繁体   English

如何仅将捕获的图像保存到我创建的文件夹中,而不保存到DCIM文件夹中

[英]How to save captured image only into a folder created by me, and not DCIM folder

I am using the native Android camera in my application and save images to my custom folder created by me programatically, but at the same time it also saved in DCIM folder of android. 我在应用程序中使用本机Android相机,并将图像以编程方式保存到我创建的自定义文件夹中,但与此同时,它也保存在android的DCIM文件夹中。 I donot want to savedin DCIM folder,or I want to delete it from DCIM Folder programatically. 我不想保存在DCIM文件夹中,或者要以编程方式将其从DCIM文件夹中删除。 How to do this.I am new in android developer. 我是Android开发人员中的新手。

ACTION_IMAGE_CAPTURE has little to do with "the native Android camera". ACTION_IMAGE_CAPTURE与“本机Android相机”无关。

By using ACTION_IMAGE_CAPTURE , you are delegating your request to an arbitrary third-party application. 通过使用ACTION_IMAGE_CAPTURE ,您可以将请求委派给任意第三方应用程序。 Dozens, if not hundreds, of different ACTION_IMAGE_CAPTURE -capable apps ship pre-installed on the thousands of Android device models. 数十种(即使不是数百种)支持 ACTION_IMAGE_CAPTURE不同应用程序已预先安装在数千种Android设备型号上。 Users are also welcome to install other apps that offer ACTION_IMAGE_CAPTURE activities. 也欢迎用户安装其他提供ACTION_IMAGE_CAPTURE活动的应用。

Any of them can do whatever they want. 他们任何人都可以做他们想做的事。

Ideally, if you specify EXTRA_OUTPUT in the ACTION_IMAGE_CAPTURE , the third-party camera app will write the photo only to the location that you specify in EXTRA_OUTPUT . 理想情况下,如果您在ACTION_IMAGE_CAPTURE指定EXTRA_OUTPUT ,则第三方相机应用会将照片仅写入您在EXTRA_OUTPUT指定的位置。 However, third-party apps can do whatever they want. 但是,第三方应用程序可以执行任何所需的操作。

I donot want to saved in DCIM folder 我不想保存在DCIM文件夹中

The user's chosen ACTION_IMAGE_CAPTURE activity can do whatever it wants. 用户选择的ACTION_IMAGE_CAPTURE活动可以执行所需的任何操作。 You do not get a vote. 您没有投票。 So, if the activity wants to save a copy of the photo to some other location, it is welcome to do so. 因此,如果活动希望将照片的副本保存到其他位置,则欢迎这样做。

I want to delete it from DCIM Folder programatically 我想以编程方式将其从DCIM文件夹中删除

You have no reliable way to know if the user's chosen ACTION_IMAGE_CAPTURE activity has saved a second copy of the photo, and you may not have permission to delete it. 您没有可靠的方法来知道用户选择的ACTION_IMAGE_CAPTURE活动是否已保存照片的第二份副本,并且您可能无权删除它。 For all you know, the user's chosen ACTION_IMAGE_CAPTURE activity will upload the image to a server somewhere. 众所周知,用户选择的ACTION_IMAGE_CAPTURE活动会将图像上传到某处的服务器。

Your choices are: 您的选择是:

  • Ignore all of this 忽略所有这一切

  • Stop using ACTION_IMAGE_CAPTURE , either by: 停止使用ACTION_IMAGE_CAPTURE ,方法是:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM