Java tutorial
//package com.java2s; import android.content.Context; import android.os.storage.StorageManager; import java.lang.reflect.Array; import java.lang.reflect.Method; public class Main { private static String[] getExternalDirs(Context context) { Context mContext = context.getApplicationContext(); StorageManager mStorageManager = (StorageManager) mContext.getSystemService(Context.STORAGE_SERVICE); try { Class<?> storageVolumeClazz = Class.forName("android.os.storage.StorageVolume"); Method getVolumeList = mStorageManager.getClass().getMethod("getVolumeList"); Method getPath = storageVolumeClazz.getMethod("getPath"); Object result = getVolumeList.invoke(mStorageManager); final int length = Array.getLength(result); final String[] paths = new String[length]; for (int i = 0; i < length; i++) { Object storageVolumeElement = Array.get(result, i); paths[i] = (String) getPath.invoke(storageVolumeElement); } return paths; } catch (Exception e) { e.printStackTrace(); } return null; } }