Android - display image of file type

I have an image that is currently stored in a variable of type File.

File img = ...;

      

What's the easiest way to display this image on the screen so I can verify that it is working correctly?

Thanks!

+2


a source to share


1 answer


If you have an ImageView in your layout, you can do something like this, assuming you have a reference to your ImageView named view

:



Drawable d = Drawable.createFromPath(img);
image.setImageDrawable(d);

      

0


a source







All Articles