A sample Android application which demonstrates the use of the YouTube Data API v3.
This sample app makes use of the YouTube Data API v3 classes to fetch a YouTube Playlist using the GetPlaylistAsyncTask which then extracts the list of Video's the playlist contains. The list of video's are then presented using a RecyclerView of CardView's in the YouTubeRecyclerViewFragment. The data binding of video details to CardView is handled by the PlaylistCardAdapter.
Picasso is used for downloading and caching the video thumbnail images. And lastly a retained fragment is used to persist the PlaylistVideos datamodel across orientation changes.
- Register your application with the Google Developer Console.
- Create an "Api Key"
- Edit ApiKey.java and update
YOUTUBE_API_KEY
with your applications "Api Key" - Edit YouTubeActivity.java and update
YOUTUBE_PLAYLISTS
with a list of your YouTube playlists.
NOTE: You MUST have a valid API key for this sample application to work. Remember, when you register your application with the Google Developer Console you need to enable the YouTube Data API.
- com.android.support:cardview-v7:25.2.0
- com.android.support:recyclerview-v7:25.2.0
- com.android.support:appcompat-v7:25.2.0
- com.squareup.picasso:picasso:2.5.2
- com.google.apis:google-api-services-youtube:v3-rev182-1.22.0
- com.google.http-client:google-http-client-android:1.20.0
- com.google.api-client:google-api-client-android:1.20.0
- com.google.api-client:google-api-client-gson:1.20.0
Phone: Single Column Portrait and Landscape
Tablet: 7" and 9" (sw600) 2 Columns Portrait, 3 Columns Landscape
Tablet: 10" (sw800) 3 Columns Portrait and Landscape