-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
  • 151,199
  • 17
  • 111
  • 216
Devrath
  • 39,949
  • 51
  • 178
  • 266

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
  • 393
  • 3
  • 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
  • 311
  • 2
  • 5
  • 13
0

To load an image

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

then

imageView.setImageBitmap(bitmap);
Anto Antony
  • 812
  • 5
  • 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
  • 156
  • 7