I have some folders and files and I would like to create a simple file browser that will allow me to browse the folders inside my asset folder then open the files inside those how can I get around it ?
Asked
Active
Viewed 563 times
-5
-
Have you tried anything so far? Your question is too broad - add more details to it. Take a look at this for example https://stackoverflow.com/questions/2938942/file-explorer-java – Sergei Sirik Aug 21 '17 at 19:45
-
Note that assets are not files on the device. They are files on your development machine. – CommonsWare Aug 21 '17 at 19:57
-
Well, they are actually files in your app's private space. In facts, you can still get them on a device (i.e.: fonts, audio files, whatever file you wouldn't put as a standard resource - in other words, an alternative to using raw). – Phantômaxx Aug 21 '17 at 20:02
-
Well the idea is, I have some files organized in some folders my objective is to find a way to browse to these folders and open the files inside them – Anouar Ben Aug 21 '17 at 21:09
-
You can do it like you would implement a normal file browser. List the directories. List the files. Put all in a listview. – greenapps Aug 21 '17 at 21:28
-
thank you Greenapps – Anouar Ben Aug 22 '17 at 17:19
1 Answers
0
Access the Assets folder files do as follows:
1- List all the files in the assets folder:
AssetManager assetManager = getAssets();
String[] files = assetManager.list("");
2- Open a certain file:
InputStream input = assetManager.open(assetName);
Further reading:

Darush
- 11,403
- 9
- 62
- 60