从带有图片扩展功能的新Google+(加)照片库中下载图片

时间:2014-02-20 06:25:35

标签: android google-plus

在新的Android版本中,他们在画廊中添加了gplus照片部分。

在我的应用程序中,我已经合并了从中选择图像的逻辑,并使用stackoverflow的以下链接显示给用户:

Download image from new Google+ (plus) Photos Application

然而,我还需要图像扩展,因为我们将图像原始数据与所选图片的扩展一起发送到API。 gplus返回像这样的图像路径

content://com.google.android.apps.photos.content/0/https%3A%2F%2Flh5.googleusercontent.com%<a bunch of letters and numbers here>

那么,我怎样才能从gplus获得该图像的扩展?有什么想法??

我成功地从上面的URI中获取了一个BITMAP。我现在只需扩展这种形象。

感谢。

1 个答案:

答案 0 :(得分:5)

使用ContentResolver.getType(uri)

Uri uri = // your content://com.google.android.apps.photos.content URI
String mimeType = getContentResolver().getType(uri);
// mimeType will be image/png, image/jpeg, etc.
相关问题