String imageInSD = Environment.getExternalStorageDirectory()+"/DCIM/Soovy/2089.jpg";
Bitmap bitmap = BitmapFactory.decodeFile(imageInSD);
if(bitmap == null){
Log.v("combine image", "null");
}else{
Log.v("combine image", "not null");
}
更新:使用了Environment.getExternalStorageDirectory()感谢信息
答案 0 :(得分:1)
请勿直接访问SD卡,尝试通过Environment
访问它。
像这样:
String imageDir = Environment.getExternalStorageDirectory()+"/DCIM/Soovy/2089.jpg";
Bitmap bitmap = BitmapFactory.decodeFile(imageDir);
if(bitmap == null){
Log.v("combine image", "null");
}else{
Log.v("combine image", "not null");
}
答案 1 :(得分:0)
试试这个:
String imageInSD = "file:///mnt/sdcard/DCIM/Soovy/2089.jpg";
但是你不应该硬编码路径。使用
Environment.getExternalStorageState()
获取sdcard的根目录。
String imageInSD = Environment.getExternalStorageState() + "/DCIM/Soovy/2089.jpg";