在开发android程序,读写sdcard时,使用绝对地址,比如:“/sdcard/folder/”等,这样写是会出问题的,正确的写法如下:
if (Environment.getExternalStorageState().equals(
Environment.MEDIA_MOUNTED)) {
String path = Environment.getExternalStorageDirectory()
.getAbsolutePath();
if (null != path) {
xxxxx
}}