Android无法从“照片"应用程序获取云图像的路径 [英] Android Unable to get path for Cloud image from Photos Application

查看:132
本文介绍了Android无法从“照片"应用程序获取云图像的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试获取绝对路径,我也获得了成功,但是当我尝试使用云映像获取该映像并在应用程序文件中使用时,找不到并获取null.我正在实现从其他应用程序接收文件的功能,例如当您从照片",图库"或文件"应用程序中选择图像并使用我的应用程序共享图像时.

I have tried to getting absolute path and I got the success too but when I try with the cloud images to get that image and used in application file is not find and getting null. I am implementing to receive files from another app like when you select image from Photos, Gallery or File application and share image by using my application.

我在这里收到了Uri content://com.google.android.apps.photos.contentprovider/0/1/mediaKey%3A%2FAF1QipOFLMMm8uXbeDMQk-P4S0Hx1dlmRDMr4SFABfVi/ACTUAL/61235243

Here I got the Uri content://com.google.android.apps.photos.contentprovider/0/1/mediaKey%3A%2FAF1QipOFLMMm8uXbeDMQk-P4S0Hx1dlmRDMr4SFABfVi/ACTUAL/61235243

当我选择Google相册云中的图片时,将首先下载该图片,然后在URI上方提供给我.从那时起,我直接在查询中执行,并在所有列中获取文件"Filename.png"的名称,但没有完整路径.

When I select image which is on Google Photos cloud and it'll be first download and then given me above URI. From that point I directly execute in query and getting the name of the file "Filename.png" in all the columns but not the full path.

当我尝试与Facebook分享相同的内容时,它会准确地显示我想分享的内容.

When same things I tried with the Facebook to share it will display in compose exact which I want to share.

我也从此链接从照片"应用程序获取路径中引用了该链接,但是问题出在云图像上.

I have also refer this from this link to get the path from Photos application, but the problem is with cloud image.

任何有解决方案或建议的人都会提出申请.

Anybody have solution or suggestion will be appriciated.

推荐答案

尝试先获取Bitmap:

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
        Uri selectedImage = data.getData();

        InputStream inputStreamBitmap = null;
        Bitmap imageBitmap = null;
        try {
            inputStreamBitmap = getContentResolver().openInputStream(inputStreamBitmap);
            imageBitmap = BitmapFactory.decodeStream(inputBitmap);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } finally {
            try {
                if (inputStreamBitmap != null) {
                    inputStreamBitmap.close();
                }
            } catch (IOException ignored) {
            }
        }
        if (imageBitmap != null) {
            processImageBitmap(imageBitmap);
        } else {
            Log.e("ImageIntent", "Error: couldn't open the specified image.");
        }
    }
}

然后,您可以将Bitmap保存到临时文件中.

Then you could save the Bitmap to a temp file if you want to.

更多详细信息此处.

这篇关于Android无法从“照片"应用程序获取云图像的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆