Android ZTE Blade III相机意图不返回数据

时间:2015-06-18 13:57:14

标签: android android-intent camera storage

我有一个问题,即在从意图打开相机后没有调用onActivityResult

Intent takeIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

额外:

takeIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));

在中兴Blade III上,我可以打开相机,但是当我按下“打勾”时没有任何反应,好像Camera中有一些异常,并且控件没有返回到调用活动 - onActivityResult没有被调用。

在其他从不使用系统的手机上(中兴通讯是4.0.4)一切正常。我也可以添加" return-data"除了Intent之外,我得到缩略图作为结果,我不想要。

PS。 photoFile的创建方式如下:

    private File createImageFile() throws IOException {
    // Create an image file name
    String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
    String imageFileName = "JPEG_" + timeStamp + "_";
    File storageDir = Environment.getExternalStoragePublicDirectory(
            Environment.DIRECTORY_PICTURES);

    File image = File.createTempFile(
            imageFileName,  /* prefix */
            ".jpg",         /* suffix */
            storageDir      /* directory */
    );

    photoPath = image.getAbsolutePath();
    return image;
}

1 个答案:

答案 0 :(得分:1)

想要添加评论,但我没有足够的声誉。

你检查了文件的空缺吗?在使用它之前 你检查文件是否存在? 你检查外部存储状态了吗?查看媒体状态是否已安装。

我也怀疑你创建文件的方式

您可以尝试使用new File('path/for/storage')或其姐妹吗?