Display Youtube Video thumbnail on Android in easy way


Recently I have implemented Youtube api in android application. One thing that google do is it provided a jar file with the help of which you can display youtube thumbnail.

But I find this method little bit more memory consuming plus in recyclerview you have to detach all references to avoid memory leakage during scrolling.

After scrolling many times it was not as smooth as must be. The main culprit was the code which download video thumbnail and display it.

So I decided to create UI for video view which was used inside a RecylerView like this


Every youtube video has video id on basics of which thumbnail is fetched. So change I made in Java code was like this.

 try {
            String title = mCollections.get(position).title;
            String description = mCollections.get(position).post_content;
            String videoID = mCollections.get(position).link;
            String imageUrl="http://img.youtube.com/vi/"+videoID+"/0.jpg";
            //Log.e("image url",imageUrl);

        } catch (Exception e) {

I am using Picaso library for image loading from network you can use whatever you like.

If you want to code in conventional way which was not working good for me you can follow on link given below



Download and run this app. On very first page , list with multiple type of item using recycler view is implemented
with youtube video, audio, images and many more view types.


Tagged with:
Written by Sanjeev Kumar

Get notifications about new posts on Twitter, RSS or Email.