2013-02-21 77 views

回答

0

該方法可以根據需要進行。適用於我

private String getAlbumName() { 
    return root folder name; 
} 

public File getAlbumDir() { 
    File storageDir = null; 

    if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) { 

     storageDir = mAlbumStorageDirFactory.getAlbumStorageDir(getAlbumName()); 

     if (storageDir != null) { 
      if (! storageDir.mkdirs()) { 
       if (! storageDir.exists()){ 
        Log.d("CameraSample", "failed to create directory"); 
        return null; 
       } 
      } 
     } 

    } else { 
     Log.v(getString(R.string.app_name), "External storage is not mounted READ/WRITE."); 
    } 

    return storageDir; 
}