E/BitmapFactory:无法解码流:java.io.FileNotFoundException:Download/my_file.JPEG(没有这样的文件或目录)
E/BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: Download/my_file.JPEG (No such file or directory)
各种方法都试过了,还是没有输出。它显示错误我尝试了各种方法。
File imgFile = new File( Environment.DIRECTORY_DOWNLOADS, "/my_file.JPEG");
if(!(imgFile==null)){
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getPath());
myImage.setImageBitmap(myBitmap);
Log.d("ashwiniiii","ashwiniii");
}
else {
myImage.setImageResource(R.drawable.ic_launcher_background);
}
File imgFile = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
if(!(imgFile==null)){
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getPath() + "/my_file.JPEG");
myImage.setImageBitmap(myBitmap);
}
else {
myImage.setImageResource(R.drawable.ic_launcher_background);
}
各种方法都试过了,还是没有输出。它显示错误我尝试了各种方法。
File imgFile = new File( Environment.DIRECTORY_DOWNLOADS, "/my_file.JPEG");
if(!(imgFile==null)){
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getPath());
myImage.setImageBitmap(myBitmap);
Log.d("ashwiniiii","ashwiniii");
}
else {
myImage.setImageResource(R.drawable.ic_launcher_background);
}
File imgFile = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
if(!(imgFile==null)){
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getPath() + "/my_file.JPEG");
myImage.setImageBitmap(myBitmap);
}
else {
myImage.setImageResource(R.drawable.ic_launcher_background);
}