我已经尝试了每种方法,但是没有输出。它显示了我尝试过各种方式的错误。
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);
}
答案 0 :(得分:0)
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);
}