Ales
Ales

Reputation: 537

Use Universal Image Loader for Internal Storage images

I have downloaded image from internet to Android and saved it into Internal storage using

FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
fos.write(string.getBytes());
fos.close();

With that image is save into /data/data/mypackagename/files folder.

Is it possible to use Universal Image Loader to load that image? This is not working for me (myfile = "filename.png").

ImageLoader.getInstance().displayImage("file://"+myfile, myImageVIew);

Upvotes: 1

Views: 500

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006584

Universal Image Loader was discontinued a year ago.

This is not working for me (myfile = "filename.png").

That is not valid path. If you are using openFileOutput(), the file will be written to the directory denoted by getFilesDir(). So, your image will be in new File(getFilesDir(), FILENAME).

If not UIL what do you suggest then?

There are dozens of image-loading libraries. Personally, I use Picasso.

Upvotes: 1

Related Questions