三星手机获取SD卡路径

/** 
 * 获取内置SD卡路径 
 * @return 
 */  
public String getInnerSDCardPath() {    
    return Environment.getExternalStorageDirectory().getPath();    
}  

/** 
 * 获取外置SD卡路径 
 * @return  返回的集合 要么只有一条记录 要么为空 
 */  
public List getExtSDCardPath()  
{  
    List lResult = new ArrayList();  
    try {  
        Runtime rt = Runtime.getRuntime();  
        Process proc = rt.exec("mount");  
        InputStream is = proc.getInputStream();  
        InputStreamReader isr = new InputStreamReader(is);  
        BufferedReader br = new BufferedReader(isr);  
        String line;  
        while ((line = br.readLine()) != null) {  
            if (line.contains("extSdCard"))  
            {  
                String [] arr = line.split(" ");  
                String path = arr[1];  
                File file = new File(path);  
                if (file.isDirectory())  
                {  
                    lResult.add(path);  
                }  
            }  
        }  
        isr.close();  
    } catch (Exception e) {  
    }  
    return lResult;  
}

你可能感兴趣的:(三星手机获取SD卡路径)