How to Create Android Video Player: 1. Generating Video List from Device

You ever find, few of the app are all most available on every Android Devices. Like Calculator, Calendar, Camera and Off course Video player too. Here I have discussed few, but there might be more.
In this series of tutorial, you will learn how to create video player with few basic steps.
How to Create Android Video Player
So, let’s start with creating project.

Topics Covered

Creating New Project

Create new android project named “Video Player”. Define Main Activity as “” and set layout as “videolist”.

Here is the Layout XML for VideoListActivity under res>layout folder.

Collecting Videos from Device

To show the list of videos, first of all we have to collect all the videos data stored in device.
Below code snippet you can use to collect video data.

Creating Adapter to show the List of Videos

Before create the VideoList Adapter we have to create layout for it. See the image below how the list item layout should look.
How to Create Android Video Player

Create new xml under res>layout named “video_item.xml”.

Now create “” and extend with BaseAdapter class.

Display Videos List on Screen

Now time to display videos list on screen in visual form. To show the list you can use following code snippet.
Define new VideoAdapter by passing generated information of videos which we have collected form device using MediaStore class. And set it to ListView using setAdapter() method.

And here is the output.

How to Create Android Video Player

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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