From the course: Android Development Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Get a list of audio files on a device

Get a list of audio files on a device - Android Tutorial

From the course: Android Development Tips

Get a list of audio files on a device

- [Instructor] Last year, I created an Android app for live performance named Audio Cues. It lets performance companies run sound for theater and other live shows. One of that app's tasks was to find existing audio files on a device and display their information. And in this tip, I'll share the code that worked for me. Whenever you want to work with files in persistent storage, whether audio or something else, you need the appropriate permission. In particular, I'll be working with files in external storage. The storage that's visible to all applications. In this beginning app's manifest file, I've added the required permission named read external storage. In last week's tip, I described how to deal with this sort of permission, known as a dangerous permission. In newer versions of Android, starting in Android 6, you have to explicitly ask for the permission at runtime, and the code to do that is already in the main activity class for this application. Down at the bottom, there's a…

Contents