2
私は、URLのフィードからの情報のクエリをretreivingいたListView情報のクエリをリストビューに入れる方法は?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView android:layout_height="wrap_content" android:id="@+id/listView1" android:layout_width="match_parent">
</ListView>
</LinearLayout>
を持っています。ここでは、フィードを取得する方法の例を示します。
query.setOrderBy(YouTubeQuery.OrderBy.VIEW_COUNT);
query.setFullTextQuery("basketball");
query.setSafeSearch(YouTubeQuery.SafeSearch.NONE);
VideoFeed videoFeed = service.query(query, VideoFeed.class);
printVideoFeed(videoFeed, true);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void printVideoFeed(VideoFeed videoFeed, boolean detailed){
videoFeed.getTitle().toString();
}
}
あなたがここで見るように私は今、私はすべての情報を保持するリストにすべての情報を設定したいと思い、この方法では...情報のフィードを盗ん。
行があるListViewなど。また、row.xmlにはimageViewとTextViewが含まれています。
どうすれば各フィードがリストビューの行に設定されるのですか?
EDIT:Googleからgdata APIを使って検索した動画のリストを取得しようとしています。ここに私が使用しているコードがあります..
public void printVideoEntry(VideoEntry videoEntry, boolean detailed){
if(detailed){
YouTubeMediaGroup mediaGroup = videoEntry.getMediaGroup();
System.out.println("Uploaded by: " + mediaGroup.getUploader());
//Here i would like to set one of the thumbnails to a imageView.
mediaGroup.getThumbnails();
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 + ",");
}
}
}
サムネイルの各ビデオタイトルとそれ自身のimageViewでリストを作成したいと思います。