拍照后命名

Take picture and name it afterwards

我要用标准系统服务拍照

Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);

然后我想给它一个自定义名称和目录或路径(这应该发生在另一个 activity 我用相机拍完照片后 activity)

问题是,如果我创建一个具有所有属性(名称、路径)的文件并将其赋予意图,我无法在拍摄照片后在 activity 中执行此操作,而我需要在我打开 Intent(拍照)之前确定它的属性。 (如 Google 文章中所建议:https://developer.android.com/training/camera/photobasics#TaskPath

我是否应该只获取全尺寸位图然后打开另一个 activity 然后保存它并确定其属性?

有没有办法按照文章中的建议去做,但反过来呢?(之后创建文件)

如果您有任何想法,请告诉我。

我希望得到任何帮助。 谢谢!

I want to take a picture with the standart system service

您的代码正在启动数百个可能的相机应用程序中的任何一个。特定应用可能已由设备制造商预装,也可能是用户安装的应用。

The problem is that if I create a file with all the attributes (name, path) and give it to the intent I cant do it in the activity after having taken the photo instead I would need to determine its attributes before I open the Intent(take the photo).

正确。

Should I just get the fullsize Bitmap then open the other activity and then save it and determine its attributes?

没有办法让 ACTION_IMAGE_CAPTURE 直接给你一个 "fullsize Bitmap"。您可以获得 缩略图 大小的 Bitmap 或让它将全尺寸照片写入您选择的位置。

Is there a way to do it as suggested in the article but somehow the other way around?(create the File afterwards)

没有。但是,没有什么可以阻止您通过 activity 中的文件打开照片,然后修改该照片并将其写回。您可以覆盖原始文件,也可以写入某个新位置。

因此,例如,如果您担心在 activity 完成之前不希望照片位于用户可访问的位置,则可以传递 Uri到指向 getCacheDir() 中私人位置的 ACTION_IMAGE_CAPTURE,然后让您的 activity 将照片的最终版本写入 external storage.

上的文件