When i press load button, im suppose to go to the galley, choose a picture and then set the imageview img to that picture. The problem is after i choose a picture in galley, the imageview does not update. However, if i press load button a second time, it take a second or two to load the galley and in that time, imageview will load the picture i previously choosen. Can someone help me so i can get imageview to refresh correctly
load.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Select Picture"), SELECT_PICTURE); try { FileInputStream in = new FileInputStream(selectedImagePath); bMap = BitmapFactory.decodeStream(in); img.setImageBitmap(bMap); if (in != null) { in.close(); } img.invalidate(); } catch (Exception e) {} } });