相机意图不适用于Panasonic toughbook fz-a2

时间:2017-08-01 19:31:19

标签: android android-intent

我正在开发一款迄今为止专门用于三星设备的应用程序。现在该应用程序需要在松下坚固垫FZ-A2上运行。除相机意图外,一切正常。当按下按钮时,相机成功启动,但在拍摄图像而不是保存图像后,它会显示以下错误"保存照片或视频时出现问题"。我用来调用相机意图的代码如下

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

// generates a new unique name base on the current date and time
String imageFileName = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SS", Locale.US).format(new Date());
imageFileName = imageFileName.replace(":", "-");
imageFileName = imageFileName.replace(" ", "_");
// capturedImage is used to keep track of where the image is saved to retrieve after intent is done.
capturedImage = new File(pictureDirectoryPath + imageFileName + ".jpg");
// makes it so the intent saves the image to a specific location
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(capturedImage));
startActivityForResult(intent, CAMERA_INTENT);

pictureDirectoryPath是在onCreate中初始化的变量,带有以下行

pictureDirectoryPath = getExternalFilesDir(Environment.DIRECTORY_PICTURES).getAbsolutePath() + File.separator + dirName + File.separator;

我能想到的唯一可能是

getExternalFilesDir(Environment.DIRECTORY_PICTURES) 

在此设备上无法正常工作。但如果是这样的话,我就不知道应该用什么来代替。

0 个答案:

没有答案