How to access the files on SD card through an app?

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

How to access the files on SD card through an app?

Postby Abhijith » Thu Oct 08, 2009 1:57 pm

Hi,
I need to search for certain type of files (like .mp3) and populate the list of files present in that particular category from the SD card. Can anyone help me with this?

-Regards Abhi.
Abhijith
Freshman
Freshman
 
Posts: 2
Joined: Thu Oct 08, 2009 1:51 pm

Top

Postby ysamlan » Thu Oct 08, 2009 9:53 pm

Same as any other file access in Java, really. Quick example:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. File f = new File ("/sdcard/")
  3.  
  4. for (String filename: f.list()){
  5.  
  6.   Log.d("test", "Filename: "+filename);
  7.  
  8. }
  9.  
  10.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


The Android docs have everything you need.
ysamlan
Once Poster
Once Poster
 
Posts: 1
Joined: Thu Oct 08, 2009 9:29 pm
Location: Boston, MA, USA

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: Google [Bot] and 3 guests