0

hi i am new to android programming, can someone please tell me how to get access to the files in a directory , i am using Environment.getExternalStorageDirectory() method?

1 Answer 1

3

That method just returns a java.io.File, so you should be able to get the files using the standard Java methods:

 String[] list(); //Returns an array of strings with the file names in the directory represented by this file. String[] list(FilenameFilter filter); //Gets a list of the files in the directory represented by this file. File[] listFiles(FileFilter filter); //Gets a list of the files in the directory represented by this file. 

( http://developer.android.com/reference/java/io/File.html )

Sign up to request clarification or add additional context in comments.

3 Comments

thanks for that. Will the be same for accessing the internal file and also how can i access the default wallpapers present in the phone via a directory structure?
That, I don't know. I've never actually used Java on Android, just on the desktop. But I'd be surprised if the wallpapers aren't hidden in the directory structure somewhere.
ok and how do i add files to a internal directory like i am using : Intent i =new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI); to get the files but currently it shows no media found , so how do i test the app?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.