奇怪的相机意图行为
我正在调用 MediaStore.ACTION_IMAGE_CAPTURE 意图 MediaStore.EXTRA_OUTPUT 额外,以便将图像保存到该位置 文件。
在 onActivityResult 我可以检查图像是否保存在 预期的文件,这是正确的。奇怪的是无论如何, 图像也保存在一个名为类似的文件中 “/sdcard/Pictures/Camera/1298041488657.jpg”(纪元时间 拍摄了图像)。
我已经检查了相机应用程序源(froyo-release 分支)并且我 几乎确定代码路径是正确的并且不必保存 图像,但我是菜鸟,我不完全确定。 AFAIK,图像 保存过程从此回调开始(评论是我的):
private final class JpegPictureCallback implements PictureCallback {
...
public void onPictureTaken(...){
...
// This is where the image is passed back to the invoking activity.
mImageCapture.storeImage(jpegData, camera, mLocation);
...
public void storeImage(final byte[] data,
android.hardware.Camera camera, Location loc) {
if (!mIsImageCaptureIntent) { // Am i an intent?
int degree = storeImage(data, loc); // THIS SHOULD NOT
BE CALLED WITHIN THE CAPTURE INTENT!!
.......
// An finally:
private int storeImage(byte[] data, Location loc) {
try {
long dateTaken = System.currentTimeMillis();
String title = createName(dateTaken);
String filename = title + ".jpg"; // Eureka,
timestamp filename!
...
所以,我收到了正确的数据,但它也被保存在 “storeImage(数据,loc);”方法调用,不应该被调用...
如果我可以从中获取新创建的文件名,那就不是问题 意图结果数据,但我不能。当我发现这一点时,我发现 我的测试中大约有 20 个我不知道的图像文件 sdcard :)
我的 Nexus One with Froyo 和我的 Nexus One 都出现了这种行为 华为 U8110 与闪电泡芙。
请问有人可以启发我吗?
多谢。
I'm invoking the MediaStore.ACTION_IMAGE_CAPTURE intent with the
MediaStore.EXTRA_OUTPUT extra so that it does save the image to that
file.
On the onActivityResult I can check that the image is being saved in
the intended file, which is correct. The weird thing is that anyhow,
the image is also saved in a file named something like
"/sdcard/Pictures/Camera/1298041488657.jpg" (epoch time in which the
image was taken).
I've checked the Camera app source (froyo-release branch) and I'm
almost sure that the code path is correct and wouldn't have to save
the image, but I'm a noob and I'm not completly sure. AFAIK, the image
saving process starts with this callback (comments are mine):
private final class JpegPictureCallback implements PictureCallback {
...
public void onPictureTaken(...){
...
// This is where the image is passed back to the invoking activity.
mImageCapture.storeImage(jpegData, camera, mLocation);
...
public void storeImage(final byte[] data,
android.hardware.Camera camera, Location loc) {
if (!mIsImageCaptureIntent) { // Am i an intent?
int degree = storeImage(data, loc); // THIS SHOULD NOT
BE CALLED WITHIN THE CAPTURE INTENT!!
.......
// An finally:
private int storeImage(byte[] data, Location loc) {
try {
long dateTaken = System.currentTimeMillis();
String title = createName(dateTaken);
String filename = title + ".jpg"; // Eureka,
timestamp filename!
...
So, I'm receiving the correct data, but it's also being saved in the
"storeImage(data, loc);" method call, which should not be called...
It'd not be a problem if I could get the newly created filename from
the intent result data, but I can't. When I found this out, I found
about 20 image files from my tests that I didn't know were on my
sdcard :)
I'm getting this behavior both with my Nexus One with Froyo and my
Huawei U8110 with Eclair.
Could please anyone enlight me?
Thanks a lot.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论