Edward
Edward

Reputation: 93

Getting the Contents of a Specific Directory on the SDCard

How would I go about getting an array of all the files in a specific directory on the sdcard, i.e. /ringtones/?

Upvotes: 4

Views: 5914

Answers (3)

3rgo
3rgo

Reputation: 3153

You should try this : http://developer.android.com/guide/topics/data/data-storage.html#filesExternal

Hope I have helped.

Upvotes: -1

androidworkz
androidworkz

Reputation: 2942

You are looking in a specific location and obviously if you are looking in the ringtones directory you want audio type files. Here is exactly how to accomplish that task.

I have created an example application for you that shows exactly how to accomplish this task

Source Code: Find files by type + play media file

Upvotes: 0

ian
ian

Reputation: 15881

It's very simple. Just do the following:

File dir = new File(path);
String[] files = dir.list();

Upvotes: 3

Related Questions