Java tutorial
//package com.java2s; //License from project: Creative Commons License import android.os.Environment; import java.io.File; public class Main { @SuppressWarnings("WeakerAccess") public static String getPathForFile(final String filename) { return (getPathForSharedStorage() + File.separator + filename); } @SuppressWarnings("WeakerAccess") public static String getPathForSharedStorage() { @SuppressWarnings("UnnecessaryLocalVariable") String storage = Environment.getExternalStorageDirectory().toString(); //String storage = "/storage/emulated/0/"; // this is what my device is seeing for above call //String storage = "/sdcard"; // because gmail can't read it, as the file must be in a 'sharable' location return storage; } }