For the YouTube thumbnails, you can use the techniques outlined in this answer to grab the url of several auto-generated thumbnails, and using an image library like Picasso
it is straightforward to load the image into an ImageView
:
private static final String EXAMPLE_YOUTUBE_VIDEO_ID = fMOqfsBzqLU;
public static String getYouTubeThumbnailUrl(String videoId) {
return "http://img.youtube.com/vi/" + videoId + "/0.jpg";
}
//To use...
Picasso.with(context).load(getYouTubeThumbnailUrl(EXAMPLE_YOUTUBE_VIDEO_ID)).into(imageView);
Use a RecyclerView
or ListView
to display the images, and set an onClickListener()
to the ImageView
that links to the video on YouTube:
public static String getYouTubeVideoLink(String videoId) {
return "https://www.youtube.com/watch?v=" + videoId;
}
//To launch the video in the defaul browser...
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(getYouTubeVideoLink(EXAMPLE_YOUTUBE_VIDEO_ID)));
startActivity(i);
Edit: To open the video in the YouTube app, you can use try the examples in this post, or explore the YouTubePlayer API.