gunescelil gunescelil - 9 months ago 52
Android Question

Sd Card Path of Android Phone

I am trying to make a file browser app. So I want to begin with displaying something like this.

enter image description here

But I can not reach my SD card's path. I used this method

String path = Environment.getExternalStorageDirectory();

In the documentation here It says:

Note: don't be confused by the word "external" here. This directory can better be thought as media/shared storage. It is a filesystem that can hold a relatively large amount of data and that is shared across all applications (does not enforce permissions). Traditionally this is an SD card, but it may also be implemented as built-in storage in a device that is distinct from the protected internal storage and can be mounted as a filesystem on a computer.

The problem is I can reach to the device storage but I can't reach to my SD card's path. Does anyone know how to get that path?


	// Access the built-in SD card
	private String getInnerSDCardPath() {
		return Environment.getExternalStorageDirectory().getPath();

	// Access to external SD card
	private List<String> getExtSDCardPath() {
		List<String> pathList = new ArrayList<String>();
		try {
			Runtime runtime = Runtime.getRuntime();
			Process proc = runtime.exec("mount");
			BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
			String line;
			while ((line = bufferedReader.readLine()) != null) {
				if (line.contains("extSdCard")) {
					String[] arr = line.split(" ");
					String path = arr[1];
					File file = new File(path);
					if (file.isDirectory()) {
		} catch (Exception e) {
		return pathList;

I hope it can help you.