我试图获得绝对路径并且我也获得了成功但是当我尝试使用云图像获取该图像并在应用程序文件中使用时找不到并且变为空。我正在实施从其他应用程序接收文件,例如从照片,图库或文件应用程序中选择图像并使用我的应用程序共享图像。
我在这里获得了Uri content://com.google.android.apps.photos.contentprovider/0/1/mediaKey%3A%2FAF1QipOFLMMm8uXbeDMQk-P4S0Hx1dlmRDMr4SFABfVi/ACTUAL/61235243
当我选择Google照片云上的图片时,它将首先下载然后给我上面的URI。从那时起,我直接执行查询并在所有列中获取文件“Filename.png”的名称,但不是完整路径。
当我尝试与Facebook分享相同的内容时,我会以精确的方式显示我要分享的内容。
我也从this link to get the path from Photos application引用了这个,但问题出在云图上。
任何人都有解决方案或建议。
答案 0 :(得分:1)
首先尝试获取liked_posts
:
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.");
}
}
}
保存到临时文件中。
更多详情here。