Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't open file in assets folder #13

Closed
hirogen317 opened this issue Mar 27, 2015 · 7 comments
Closed

can't open file in assets folder #13

hirogen317 opened this issue Mar 27, 2015 · 7 comments

Comments

@hirogen317
Copy link

I tried SimpleDraweeView.setImageURI and set a file:///android_asset resource.

xx.setImageURI(Uri.parse("file:///android_asset/....jpg"));
But it shows an error:
can't open '/android_asset/xxx.jpg'
And if I use:
xx.setImageDrawable(new BitmapDrawable(getAssets().open("xxx.jpg")));
This is correct.
I am new to android. Do I make some mistakes? If there are some problems, please let me know. :-)

@IanChilds
Copy link
Contributor

Can you try asset://...jpg? See http://frescolib.org/docs/supported-uris.html

@hirogen317
Copy link
Author

Thank you, IanChilds. Resolved.
I am sorry that I failed to reach the document.
I use:

Uri.parse("asset:///...")
and solved this problem.

@IanChilds
Copy link
Contributor

No problem. Hope you find Fresco useful!

@quynhbk
Copy link

quynhbk commented Nov 18, 2015

I can't load from:
newUrl = "assets://images/common/place_detail/default_place.png";
heap me!

@anotherdev
Copy link

@quynhbk you are using UIL scheme. Fresco one doesn't have s (use asset://);

Fresco should support file:///android_asset/ instead of creating new scheme and don't documented clearly that asset:// scheme is vendor specific.

Picasso: square/picasso#332
Glide: http://stackoverflow.com/questions/29982341/using-glide-for-android-how-do-i-load-images-from-asset-and-resources

@Dima564
Copy link

Dima564 commented Feb 4, 2016

+1 to file:///android_asset/

@tarifchakder
Copy link

val inputStream : InputStream = context.assets.open("image/myimg.png")
val bitmap = BitmapFactory.decodeStream(inputStream)
img.setImageBitmap(bitmap)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants