I have the following code to get my JPG file from a directory on my Android device:
File f = new File(cacheDir, fn);
How do I take f
and put it in an ImageView?
ImageView imgView = (ImageView)header.findViewById(R.id.imvCover);
// what call do I make here?
// this obviously is not correct and just for example.
imgView.setToFile(f);
try this. Since you are having a file object use the below code.
This may help you
Bitmap bmp = BitmapFactory.decodeFile(f.getAbsolutePath());
imgView.setImageBitmap(bmp);
I think this is correct, no?
Bitmap b = decodeFile(f);
imgView.setImageBitmap(b);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.