I have an imageView with a given image in xml. However, when I try to change the image, ImageView never displays the second image. Instead, it displays a blank screen. I tried the code with and without invalidate (), and there were no changes.
ImageView image;
String imgPath=Environment.getExternalStorageDirectory()+"/Music/Evanescence - Discography - 1998-2011 (320 kbps)/Album's/2000 Origin (Limited Edition) (320 kbps)/Scans covers/06.jpg";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
image=(ImageView)findViewById(R.id.imageView1);
image.setImageBitmap(BitmapFactory.decodeFile(imgPath));
if(!new File(imgPath).exists())
Log.i("aaa","File doesnt exist");
Log.i("aaa","DONE. img path: "+imgPath);
}
source
share