是否可以以字符串形式获取 Android 应用程序资产文件的完整路径?
我正在尝试在我的 Android 应用程序中使用第三方库,该库只允许我使用表示文件路径的字符串加载文件。我已将此文件放置在应用程序的资产文件夹中,认为我可以使用 AssetManager 将其路径作为字符串获取。但是,它仅返回文件的相对路径。所以我想知道是否有某种方法可以获得文件的完整路径,以便该库可以成功加载文件。
I'm trying to use a third party library in my Android app that only allows me to load a file using a string that represents the path to the file. I've placed this file in my app's assets folder thinking that I could use the AssetManager to get its path as a string. However, it only returns a relative path to the file. So I'm wondering if there's some way to get the full path to the file so this library can successfully load the file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只是猜测 -
Resources.getResourceName()
可以解决这个问题吗?Just a guess - does
Resources.getResourceName()
do the trick?