-2

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?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Devrath
  • 42,072
  • 54
  • 195
  • 297

4 Answers4

1

you can use Picasso for that

Picasso.with(context).load(new File(...)).into(imageView);

refernce: http://square.github.io/picasso/

Rofaeil Ashaiaa
  • 663
  • 5
  • 9
0

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

jcbrowni
  • 321
  • 2
  • 5
  • 13
0

To load an image

File imgFile = new  File(pathToPicture);
Bitmap bitmap = BitmapFactory.decodeFile(pathToPicture);

then

imageView.setImageBitmap(bitmap);
Anto Antony
  • 842
  • 6
  • 12
0

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();
    }
Thien Huynh
  • 166
  • 7