Java tutorial
//package com.java2s; import java.io.File; import java.util.ArrayList; import java.util.List; import android.os.Environment; import android.util.Log; public class Main { private final static String LOG_TAG = "ImpExp"; private final static String DIR_NAME = "TVN"; /** * * @param subDirName * @return */ public static String[] constructFileList(String subDirName) { List<String> fileList = null; String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { File subDir = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + DIR_NAME + File.separator + subDirName); if (subDir.exists()) { File[] files = subDir.listFiles(); for (int i = 0; i < files.length; i++) { if (fileList == null) { fileList = new ArrayList<String>(); } // remove the extension fileList.add(files[i].getName().split("\\.")[0]); } } else { Log.e(LOG_TAG, "Nothing to import"); } } return fileList.toArray(new String[fileList.size()]); } }