首页 > 代码库 > android获取sd卡路径方法

android获取sd卡路径方法

public String getSDPath(){
  File sdDir = null;
  boolean sdCardExist = Environment.getExternalStorageState()
  .equals(android.os.Environment.MEDIA_MOUNTED); //判断sd卡是否存在
  if (sdCardExist)
  {
  sdDir = Environment.getExternalStorageDirectory();//获取跟目录
  }
  return sdDir.toString();
 }