When I am calling this function there is no image in image view
bitmapFactory.decodefile(filename)
showing null .. please help for this.
Here is my code :
public Bitmap ShowImage(String imageName,String userImageName )
{
File sdcard_mainDirectory = new File(Environment.getExternalStorageDirectory(),"UserImages").getAbsoluteFile();
File file = new File(sdcard_mainDirectory, userImageName).getAbsoluteFile();
if (file != null) {
try {
String imageInSD = "/sdcard/UserImages/"+userImageName;
Bitmap bitmap = BitmapFactory.decodeFile(imageInSD);
return bitmap;
}
catch (Exception e) {
e.printStackTrace();
}
}
return null;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…