Android Utililty Methods SDCard Root Get

List of utility methods to do SDCard Root Get

Description

The list of methods to do SDCard Root Get are organized into topic(s).

Method

StringgetExternalCacheDir(Context context)
get External Cache Dir
if (hasExternalCacheDir()) {
    return context.getExternalCacheDir().getPath() + File.separator
            + "gesture";
final String cacheDir = "/Android/data/" + context.getPackageName()
        + "/cache/gesture/";
return Environment.getExternalStorageDirectory().getPath()
        + cacheDir;
...
StringgetRootFilePath()
get Root File Path
if (hasSDCard()) {
    return Environment.getExternalStorageDirectory()
            .getAbsolutePath() + "/";
} else {
    return Environment.getDataDirectory().getAbsolutePath()
            + "/data/";
StringgetSDCardRoot()
get SD Card Root
return Environment.getExternalStorageDirectory().getAbsolutePath()
        + File.separator;
FilegetOutputMediaFile()
get Output Media File
File mediaStorageDir = new File(
        Environment
                .getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
        "ThanksAndroid");
if (!mediaStorageDir.exists()) {
    if (!mediaStorageDir.mkdirs()) {
        Log.d("MyCameraApp", "failed to create directory");
        return null;
...
FilegetOutputMediaFile(int type)
Creates a media file in the Environment.DIRECTORY_PICTURES directory.
if (!Environment.getExternalStorageState().equalsIgnoreCase(
        Environment.MEDIA_MOUNTED)) {
    return null;
File mediaStorageDir = new File(
        Environment
                .getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
        "CameraSample");
...
UrigetOutputMediaFileUri()
get Output Media File Uri
File mediaStorageDir = new File(
        Environment
                .getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
        "MyCameraApp");
if (!mediaStorageDir.exists()) {
    if (!mediaStorageDir.mkdirs()) {
        Log.d("MyCameraApp", "failed to create directory");
        return null;
...