简体   繁体   English

在Android上从Picasa检索图像

[英]retrieving images from Picasa on android

hello am trying to get images from an album from picasa in an android app. 您好,我试图在Android应用中从picasa的相册中获取图像。 I tried creating an album and the album was created successfully however there is something wrong when i try to get the images in the album. 我尝试创建相册并成功创建了相册,但是在尝试获取相册中的图像时出现了问题。 Please find below my code: 请在下面找到我的代码:

PicasawebService myService = new PicasawebService("myApp");
myService.setUserCredentials("username", "password");
URL url = new URL ("https://picasaweb.google.com/data/feed/api/user/myusername/albumid/myalbumid");
AlbumFeed  feed= myService.getFeed(url, AlbumFeed.class);
List<MediaContent> l;
for(PhotoEntry photo : feed.getPhotoEntries()){
l= photo.getMediaContents();
return l.get(0).getUrl().toString();
 }

the for loop is not being entered but when i check the size of the feed and it shows me the correct number of images in the album. for循环没有被输入,但是当我检查feed的大小并且显示给我相册中正确数量的图像时。 I got the code from google developers guide:(https://developers.google.com/picasa-web/docs/2.0/developers_guide_java#listalbums) NB: i tried the same exact code in a desktop app and worked perfectly. 我从Google开发人员指南获得了代码:(https://developers.google.com/picasa-web/docs/2.0/developers_guide_java#listalbums)注意:我在桌面应用程序中尝试了相同的代码,并且运行良好。 Thank you 谢谢

EDIT: The problem is that the ALbumFeed is returning entries of class GPhotoEntry and not PhotoEntry. 编辑:问题是ALbumFeed返回类GPhotoEntry而不是PhotoEntry的条目。 I searched online and the solution was to include the gdata-photos-meta.jar in my library which was already included...Any idea? 我在网上搜索,解决方案是将gdata-photos-meta.jar包含在我的图书馆中,该图书馆已经包含了。。。

google's GData doesnt work with android. 谷歌的GData不适用于Android。 You should use google Client api and they say that there is a running sample for picasa on android. 您应该使用google Client API,他们会说android上有一个正在运行的Picasa示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM