I have a image downloaded locally in application
/data/data/com.starboard.stella/files/Stella/FragranceFinder/QuestionImages/option1_woman.png
How do I access the image to set for image view?
I have a image downloaded locally in application
/data/data/com.starboard.stella/files/Stella/FragranceFinder/QuestionImages/option1_woman.png
How do I access the image to set for image view?
you can use Picasso for that
Picasso.with(context).load(new File(...)).into(imageView);
refernce: http://square.github.io/picasso/
Creating a File type using your filepath, creating a Bitmap out of that File and setting the Image bitmap of your ImageView using setImageBitmap is probably the best way to go.
Paresh Mayani gives a great solution with code here: https://stackoverflow.com/a/4182060/5920187
To load an image
File imgFile = new File(pathToPicture);
Bitmap bitmap = BitmapFactory.decodeFile(pathToPicture);
then
imageView.setImageBitmap(bitmap);
I think you should try this:
try {
File file = new File(getExternalFilesDir(null) + "/Stella/FragranceFinder/QuestionImages/", "option1_woman.png");
Bitmap bitmap = BitmapFactory.decodeStream(new FileInputStream(file));
ImageView image =(ImageView)findViewById(R.id.image);
image.setImageBitmap(bitmap);
} catch (FileNotFoundException e) {
e.printStackTrace();
}