Folder Audio List



In this blog post we will use MediaStore.Audio class to reterive our audio files from android device.

Folder

Not audio file (already done with a FileFilter) not show empty folders (already done but has the recursive problem) not show folders with.nomedia file (that tells me that there aren't any media files, but has the recursive problem). Also many folders created by others application don't put the.nomedia file. Users are asking to add a Folder view to list all folders that has music in their smartphone and I want to develop it. MediaStore already know which are the correct paths to follow (because it needs to know them to re-scan every times the sdcard) so I was wondering if there is a way to get those paths and use them to show music to the user. The MP3 is probably the most popular audio file format on this list. Often times, the terms MP3 and audio file are used interchangeably, regardless of whether the format being used is actually an MP3. The MP3’s popularity is primarily due to its versatility. The File Manager will present you with a list of the missing files and associated controls. The File Manager’s List of Missing Files. 5.7.1 Manual Repair. To manually fix a broken file reference, locate the missing file in the browser, drag it over to the File Manager and drop it on the respective line in the list of missing files. Directory List & Print can extract more than 100 meta tags from image files (Exif / IPTC), audio and video files as well as from most documents and PDFs and display information such as title, artist, album, length of song, recording date, picture format, picture size, camera settings, author, number of pages, creation date or date taken, file size, GPS data with corresponding Google Maps link and much more.

MediaStore.Audio is works like a container. It contains all the audio files from internal and external storage.

We will follow some basic steps to retrieve audio files-

Now its time to convert these steps into android code.

1- Get Audio Files-

We will use MediaStore.Audio file to retrieve the audio files from storage(internal or external).

Folder audio listen to

Folder Audio Listening

First we have to spacify what are the contents we are going to retrieve, for that we will create an array of projections we need.

Here is the code flick for that-

Ok, we know what content we need, now set the projection and make a query for data, for that purpose we will use Cursor interface.

Folder Audio Listen

Folder Audio List

Cursor is very useful when you are retrieving some data from storage. It provides read-write access tothe result set return by a query.

Here is the code flick for that-

Folder Audio List

2- Add result-set into a List-

Audio

We have all the data access using above query . Now add that data into a list.

Here is the code flick for that-

3- Display List-

Now its the time to display all the data into a View. For that we have to create a ListView in the layout and then create an Adapter to bridg between View and program part.

Here is the code flick for that-

Here is the Complete code-

Folder Audio Listen To

Hope this post will help you..!!

Thanks.