获取多媒体资料中的图像从Picasa中//谷歌+同步文件夹不起作用文件夹、不起作用、图像、多媒体

2023-09-04 03:05:29 作者:借万里青山为隔

我想从画廊的应用程序的图像从Google+的同步照片的文件夹之一。选择图像后,乌里被传递回正常。但是,当我试图获取图像的实际路径的存储设备上,这样我就可以使用它,它崩溃。这个问题似乎是专门用在 Picasa的内容提供商

在测试的Nexus S和Nexus 7和其他设备也是如此。

E / AndroidRuntime(14572):java.lang.RuntimeException的:不提供结果ResultInfo {谁= NULL,请求= 1,结果= -1,数据=意向{DAT =内容://com.google.android.gallery3d.provider / Picasa中/项目/ 5427003652908228690}}

在这里,DAT场似乎是正确传递开放的,但是当我尝试获取图像的位置,它与以下错误崩溃。

W / GalleryProvider(14381):不支持的列:_data

看来,内容提供者对Picasa相簿没有_data字段

在code获取的位置是:

// imageUri是开放的我们从上面。
的String []凸出= {MediaStore.Images.Media.DATA};
光标光标= context.getContentResolver()查询(imageUri,凸出,NULL,NULL,NULL);
INT与Column_Index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();

字符串文件路径= cursor.getString(Column_Index中);
cursor.close();
picasa中文版下载 谷歌图片浏览器免费版 电脑版 极光下载站

这似乎支持这一形象的列有: [user_account,picasa_id,_display_name,_size,MIME_TYPE,datetaken,经度,纬度,方向]

我们得到这个图像的实际位置如何。如果我们不应该用这个形象的工作,这些图片不能显示在首位用户。

启动库的应用程序的目的是:

意向意图=新的意图();
intent.setType(图像/ *);
intent.setAction(Intent.ACTION_GET_CONTENT);

解决方案

大量的调查研究后,我觉得有太多的变通办法做一些事情,这似乎是很简单的。于是,我就提前写了一个小库,处理所有复杂的,如果别人的,并正好工作,我能想到的所有可能出现的情况。请试一试,看看这会有所帮助。

http://techdroid.kbeanie.com/2013/03/easy-image-chooser-library-for-android.html

这是一个初步的实现。虽然处理几乎任何情况下,都会出现一些错误。如果您使用此库,请让我知道您的反馈,如果在所有它可以进一步提高。

I am trying to get an image from the gallery app from one of the folders from the Google+ synced photos. After selecting the image, the Uri is being passed back correctly. But when I try to get the actual path of that image on the storage device, so that I can use it, it crashes. The problem seems to be specifically with the picasa content provider.

Tested on Nexus S and Nexus 7, and other devices as well.

E/AndroidRuntime(14572): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { dat=content://com.google.android.gallery3d.provider/picasa/item/5427003652908228690 }}

Here, the dat field seems to be correctly passing the Uri, but when I try to fetch the image's location, it crashes with the following error.

W/GalleryProvider(14381): unsupported column: _data

Seems that the content provider for Picasa albums doesn't have a _data field.

The code for getting the location is:

// imageUri is the Uri from above.
String[] proj = { MediaStore.Images.Media.DATA };
Cursor cursor = context.getContentResolver().query(imageUri, proj,null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();

String filePath = cursor.getString(column_index);
cursor.close();

The only columns that seem to be supported for this image are: [user_account, picasa_id, _display_name, _size, mime_type, datetaken, latitude, longitude, orientation]

How do we get the actual location of this image. And if we are not supposed to work with this image, these images shouldn't be shown to the user in the first place.

The Intent to launch the gallery app is:

Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);

解决方案

After a lot of research, I felt that there were too many workarounds to do something which seems to be quite simple. So, I went ahead a wrote a small library that handles all the complex if elses and happens to work for all possible scenarios that I can think of. Do give it a try and see if this helps.

http://techdroid.kbeanie.com/2013/03/easy-image-chooser-library-for-android.html

This is an initial implementation. Although it handles almost every situation, there could be a few bugs. If you use this library, please let me know your feedback and if at all it could be improved any further.