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.
- androidx.cardview:cardview:1.0.0
- androidx.recyclerview:recyclerview:1.3.2
- androidx.appcompat:appcompat:1.6.1
- com.squareup.picasso:picasso:2.71828
- com.google.apis:google-api-services-youtube:v3-rev20231011-2.0.0
- com.google.http-client:google-http-client-android:1.43.3
- com.google.api-client:google-api-client-android:2.2.0
- com.google.api-client:google-api-client-gson:2.2.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