Android examples for android.os:Environment
get SD Path
import android.content.Context; import android.content.res.AssetManager; import android.os.Environment; import android.text.format.DateFormat; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.URLDecoder; import java.net.URLEncoder; import java.util.ArrayList; public class Main{ public static String getSDPath() { File sdDir = null;/*from w ww . ja va 2 s.co m*/ boolean sdCardExist = Environment.getExternalStorageState().equals( android.os.Environment.MEDIA_MOUNTED); if (sdCardExist) { sdDir = Environment.getExternalStorageDirectory(); return sdDir.toString(); } else { return null; } } }