问题
is it possible to use picasso library to load image from sdcard to imageView ?
回答1:
As picasso doc provided,
Resources, assets, files, content providers are all supported as image sources.
You can simply do like it
String filename = "YOURIMAGE.png";
String path = "/mnt/sdcard/" + filename;
Picasso.with(context).load(new File(path)).into(imageView);
Edit
As @Budius suggested, the better way to access file from disk path, use Enviroment
class.
String filename = "YOURIMAGE.png";
String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath();
Picasso.with(context).load(new File(baseDir + File.separator + filename)).into(imageView);
Hope it will work for you.
回答2:
You need to first convert your image to a Uri
, and then load it using Picasso the same way you did for any images.
来源:https://stackoverflow.com/questions/28983659/androidload-image-from-sdcard-with-picasso