Wednesday, August 31, 2011

how to access sdcard in android Devolpment?

In this example I am accessing AudioRecorder Folder in sdcard.
String filepath = Environment.getExternalStorageDirectory().getPath();
        file = new File(filepath,"AudioRecorder");

        if (!file.exists())
        {
            file.mkdirs();
        }
 String[] a = file.list(new FilenameFilter() {

            @Override
            public boolean accept(File dir, String filename)

            {
                return (filename.endsWith(".mp4") || filename.endsWith(".3gp")||filename.endsWith(".mp3"));

            }
        });

        for (String string : a)

        {

            a1.add(string);

        }
  


No comments:

Post a Comment