I want to write an android application that can parse files. I have figured out the parser part of it but now I m stuck at how to actually input the files. The files can actually be anything – music files, image files, text files or video files. The parser recognises the file format and parses it accordingly. Can anyone tell me how to write the UI and code to actually input files (I am programming in java in eclipe). Ideally the user should be able to go through the folders in the phone, just like we do in the computer, and then choose which file.
Any help is greatly appreciated !
So what you need I think is a file browser or manager, right? Unfortunately, Android doesn’t provide a native file manager,and you have two choices to select files in the sd card.
There are some free third-party file managers,such as ES file manager and OI file manager. They provide hook for the developers to call via Intent. I am using OI. It’s open-source.
You can also implement your own file manager. Well, it would be a little more difficulty than the 1st solution and you have a lot of work to do. I may suggest you use a listView, and list the dirs in the sd card. You may use android.os.Environment class to check the state of the sd card and use java.io.File to get info about the dirs and files.Also, see here to learn how to read files from SD card.