I need to pass a third party library the path of an image that is stored in my assets folder
I have read a few answers but none helped. I have tried file:///android_asset/uk.jpg
and it doesn't work
I need to pass a third party library the path of an image that is stored in my assets folder
There is no path. Your asset is not a file. It is an entry in a ZIP archive, nothing more.
Your options are:
Open an InputStream
on the asset using open()
from AssetManager
, and pass that InputStream
to the library
Open an InputStream
on the asset using open()
from AssetManager
, use that to copy the asset to some location (eg, internal storage ), then pass the path to the file that you just created
Switch to a library that allows you to supply an InputStream
or is Android-aware and supports assets directly
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.