Java tutorial
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.IOException; import android.os.Environment; import android.support.annotation.NonNull; import android.util.Log; public class Main { /** * Get the SD card directory. * * @return The SD card directory. */ @NonNull public static String getSdCardPath() { String sdCardDirectory = Environment.getExternalStorageDirectory().getAbsolutePath(); try { sdCardDirectory = new File(sdCardDirectory).getCanonicalPath(); } catch (IOException ioe) { Log.e("Uri", "Could not get SD directory", ioe); } return sdCardDirectory; } }