Android Select Multiple Video From Gallery Programmatically | Video Picker

This tutorial is about Android Select Multiple Video From Gallery Programmatically.

We will create a video picker app today in the android studio.

Our app will be able to select or pick multiple videos from the gallery.

You can also use this example as an module of your existing app. Code is very simple to understand and integrate in any android studio project.

After selecting multiple videos, we will show two videos in the videoview as an example.

Follow below steps to learn about choosing multiple videos from gallery.

Proof of this android select multiple video from gallery tutorial

Consider following images which showcase the output of this example.

android select multiple video from gallery

First Screen


android select multiple video from gallery

Selecting Videos


android select multiple video from gallery

playing two videos

1. Read Permission

To read all the videos from the gallery of android device, we need read external storage permission.

Add below coding line in AndroidManifest.xml file

You can learn here how to programmatically request runtime permission in android.

2. Changing default activity

When you create new project in the android studio by default you have main activity.

Replace the code of activity_main.xml with below source code

In the above layout file, I have taken two videoviews and one button.

When the user will click the button, a new screen will appear. This screen shows all the videos available on the android device.

From here, user will select multiple videos or single video.

After completing selecting videos, app will come back to first screen.

Now among the multiple selected videos, first two videos will be shown in the two videoviews.

Replace the code of with the following one

Button Click

Compiler will execute following code when the user clicks the button.

System will open a screen with all the videos to select via intent.

When the user finishes selecting videos system will run the below code

Here, we will run one method called getSelectedVideos() which will return the string arraylist.

This arraylist contains all the paths of the selected videos.

Out of whole arraylist, we will pick first two paths and we will play videos in the two videoviews.


The code for getSelectedVideos() method is as below

I have not used any third party github library in this tutorial.

Third party libraries are responsible for increasing apk size of the apk. So generally, I always try to use them as less as possible.

But if you still want to use any then consider the below links.

Here are some quick links which includes third party libraries.

Thank you very much for reading android select multiple video from gallery tutorial.

Have a nice day!

Download the Source Code

[sociallocker]Download Source Code For Select MultipleVideo Galley[/sociallocker]

Hardik Parsania

I am mobile app developer. I am always passionate about solving complex and real world problems.I have developed many apps with great interest and superior logical skills.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *