Hi I need to keep my images and their sounds on a separate folder inside res folder structure.After that i need to read and display image from that folder to my application please reply
Asked
Active
Viewed 1,249 times
2 Answers
1
Yes , You can create a separate folder named raw within res folder (res/raw) and keep your drawable and sounds in that folder.

Dinesh Sharma
- 11,533
- 7
- 42
- 60
-
can we create another two more folder inside that raw folder – Anish Apr 18 '11 at 08:12
0
You can save your images to res/drawable and your sound files to res/raw.
If you really want to create a separate folder for your sound and image files, you can create it on your SD Card. Please see the example codes below:
File fileList= new File("/sdcard/MyFiles/");
//Store the file names within MyFiles folder to pathList[]
pathList = fileList.list();
//Create the URI path of your files here
StringBuilder sb = new StringBuilder();
sb.append("/sdcard/MyFiles/"+pathList[index1]);
pathList[index1]=sb.toString();
//Here is how you can play your sound files
MediaPlayer mp = new MediaPlayer();
mp.setDataSource(PATH_TO_FILE);
mp.prepare();
mp.start();

Erick
- 1,247
- 3
- 15
- 24