android 如何从包中获取文件名
这是 Android 问题。
有谁知道如何从包中而不是从资源文件夹中获取文件名(作为字符串)?
例如,如果normal.xml存储在src/com.example.xml/normal.xml
中,我如何获取字符串形式的文件名?
谢谢你!
This is Android question.
Does anyone know how I can get file names (as String) from the package and not from the resource folder?
For example, if normal.xml is stored in src/com.example.xml/normal.xml
, how can i get the name of the file as String?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您有权访问 .apk(在安装之前,或者因为它是您的应用程序,或者因为它安装在没有复制保护的设备上并且您知道其确切路径名),则可以将其作为 zip 文件读取。
If you have access to the .apk (either before installation, or because it is your application, or because it is installed on the device without copy protection and you know its exact path name) you can read it as a zip file.
您可以将类似的内容放置在同一名称空间中加载的任何 Activity 的 OnCreate() 方法中:
这将列出在您的 Activity 所在的同一文件夹中找到的所有文件。您可以将
"./"
更改为此 Activity 所在的com.example.xml
目录中您希望的任何相对路径。You can place something like this in the OnCreate() method of whatever Activity is loaded in that same namespace:
This will list all of the files found in the same folder that you have your Activity. You can change
"./"
to be whatever relative path you would wish from thecom.example.xml
directory where this Activity lives.