/*** Get a top-level shared/external storage directory for placing files of a* particular type. This iswherethe user will typically place and manage* their own files, so you should be careful about what you put here to* ensure you don't erase their files orgetinthe way of their own* organization.* <p>* On devices with multiple users (as described by {@link UserManager}),* each user has their own isolated shared storage. Applications only have* access tothe shared storage forthe user they're runningas.* </p>* <p>* Here is an example of typical code to manipulate a picture onthe public* shared storage:* </p>* {@sample development/samples/ApiDemos/src/com/example/android/apis/content/ExternalStorage.java* public_picture}** @param type The type of storage directory toreturn. Should be one of* {@link #DIRECTORY_MUSIC}, {@link #DIRECTORY_PODCASTS},* {@link #DIRECTORY_RINGTONES}, {@link #DIRECTORY_ALARMS},* {@link #DIRECTORY_NOTIFICATIONS}, {@link #DIRECTORY_PICTURES},* {@link #DIRECTORY_MOVIES}, {@link #DIRECTORY_DOWNLOADS},* {@link #DIRECTORY_DCIM}, or {@link #DIRECTORY_DOCUMENTS}. May not be null.* @return Returns the File path forthe directory. Note that this directory* may not yet exist, so you must make sure it exists before using* it such aswith {@link File#mkdirs File.mkdirs()}.*/public static File getExternalStoragePublicDirectory(String type) {throwIfUserRequired();
return sCurrentUser.buildExternalStoragePublicDirs(type)[0];}
/*** @param type The type of files directory to return. May be {@codenull}* for the root of the files directory or one of the following* constants for a subdirectory:* {@link android.os.Environment#DIRECTORY_MUSIC},* {@link android.os.Environment#DIRECTORY_PODCASTS},* {@link android.os.Environment#DIRECTORY_RINGTONES},* {@link android.os.Environment#DIRECTORY_ALARMS},* {@link android.os.Environment#DIRECTORY_NOTIFICATIONS},* {@link android.os.Environment#DIRECTORY_PICTURES}, or* {@link android.os.Environment#DIRECTORY_MOVIES}.* @return the absolute path to application-specific directory. May return* {@codenull} if shared storage isnot currently available.* @see#getFilesDir* @see#getExternalFilesDirs(String)* @see Environment#getExternalStorageState(File)* @see Environment#isExternalStorageEmulated(File)* @see Environment#isExternalStorageRemovable(File)*/@Nullablepublic abstract File getExternalFilesDir(@Nullable String type);