如何将youtube数据设置为android小部件?

时间:2011-08-03 15:17:37

标签: android youtube-api

这是我用来使用youtube数据api检索搜索到的视频列表的代码。

 if(detailed) {

YouTubeMediaGroup mediaGroup = videoEntry.getMediaGroup();

System.out.println("Uploaded by: " + mediaGroup.getUploader());

System.out.println("Video ID: " + mediaGroup.getVideoId());
System.out.println("Description: " + 
  mediaGroup.getDescription().getPlainTextContent());

MediaPlayer mediaPlayer = mediaGroup.getPlayer();
System.out.println("Web Player URL: " + mediaPlayer.getUrl());
MediaKeywords keywords = mediaGroup.getKeywords();
System.out.print("Keywords: ");
for(String keyword : keywords.getKeywords()) {
  System.out.print(keyword + ",");
}

GeoRssWhere location = videoEntry.getGeoCoordinates();
if(location != null) {
  System.out.println("Latitude: " + location.getLatitude());
  System.out.println("Longitude: " + location.getLongitude());
}

Rating rating = videoEntry.getRating();
if(rating != null) {
  System.out.println("Average rating: " + rating.getAverage());
}

YtStatistics stats = videoEntry.getStatistics();
if(stats != null ) {
  System.out.println("View count: " + stats.getViewCount());
}
System.out.println();

System.out.println("\tThumbnails:");
for(MediaThumbnail mediaThumbnail : mediaGroup.getThumbnails()) {
  System.out.println("\t\tThumbnail URL: " + mediaThumbnail.getUrl());
  System.out.println("\t\tThumbnail Time Index: " +
  mediaThumbnail.getTime());
  System.out.println();
}

如何将此信息转换为使用标题的文本视图,缩略图的ImageView?

0 个答案:

没有答案