Android SDCard Root Get getRootFilePath()

Here you can find the source of getRootFilePath()

Description

get Root File Path

Declaration

public static String getRootFilePath() 

Method Source Code

//package com.java2s;

import android.os.Environment;

public class Main {
    public static String getRootFilePath() {
        if (hasSDCard()) {
            return Environment.getExternalStorageDirectory()
                    .getAbsolutePath() + "/";
        } else {/*from  w w  w.j a v a  2s . c  o  m*/
            return Environment.getDataDirectory().getAbsolutePath()
                    + "/data/"; 
        }
    }

    public static boolean hasSDCard() {
        String status = Environment.getExternalStorageState();
        if (!status.equals(Environment.MEDIA_MOUNTED)) {
            return false;
        }
        return true;
    }
}

Related

  1. getExternalCacheDir(Context context)
  2. getSDCardRoot()
  3. getOutputMediaFile()
  4. getOutputMediaFile(int type)
  5. getOutputMediaFileUri()