Code Snippets

How to take screenshot programmatically in android

Sometimes in our android application development we have requirement like taking a screenshot of whole screen or screenshot of fixed area. Following example explain how to take screenshot programmatically. At first we need storage write permission because we will store screenshot in our device storage. Code for write storage permission. Declare WRITE_EXTERNAL_STORAGE  permission in AndroidManifest.  …

How to take screenshot programmatically in android Read More »

Load thumbnail of YouTube video from Url with and without Glide

To load thumbnail of video from Youtube we need internet permission. It is necessary declare INTERNET permission in AndroidManifest.  AndroidManifest.xml file Here is our design layout activity_main.xml To load thumb from YouTube video we need Video Id and Url. For example this video. We have url https://www.youtube.com/watch?v=KpbGMxmOZDQ Copy the video id from url after v= i.e KpbGMxmOZDQ. Now to load Medium …

Load thumbnail of YouTube video from Url with and without Glide Read More »

Load thumbnail of video from Storage (File Uri) with and without Glide

In our application when we want to show list of video as thumbnail below code might be useful. It uses MediaStore.Video.Thumbnails for thumbnail. It provide two types of thumbnails first is MICRO_KIND and second is MINI_KIND. As from the name MICRO_KIND provides bigger thumbnail as compares to MICRO_KIND. To load thumbnail of video from storage …

Load thumbnail of video from Storage (File Uri) with and without Glide Read More »