Medo Zeus
Medo Zeus

Reputation: 99

android Picasso load image from storage

i am using Picasso for load image from web and local storage

for load image from web

Picasso.with(context).load("https://i.sstatic.net/jEIKP.jpg").into(imageView);

and for load image from storage i add file:// before path for load image

Picasso.with(context).load("file:///android_asset/DvpvklR.png").into(imageView2);

but when file path have utf-8 charchter with file name its not load the image like file:///android_asset/۲۰۱٧.png

any idea how to solve it every time i want to use picaso its must string path not Uri or File because its saved in sqlite as string

Upvotes: 1

Views: 2287

Answers (2)

user5646001
user5646001

Reputation:

Try this code:

String url = "file:///android_asset/۲۰۱٧.png";
URLEncoder.encode(url, "UTF-8");
Picasso.with(context).load(url).into(imageView2);

Upvotes: 1

Tomer Shemesh
Tomer Shemesh

Reputation: 13335

try doing

URIUtil.encodeQuery(url)

see the issue at:

https://github.com/square/picasso/issues/652

Upvotes: 0

Related Questions