Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的androidTest/resources目录中,我有数百张图片。我想循环阅读所有这些并针对特定功能进行测试。我不想使用他们的名字,因为我经常不认识他们。是否有可能通过正则表达式加载或遍历目录?
androidTest/resources
我找到了解决方案。将目录的名称从更改resources为assets,然后使用InstrumentationRegistry.getInstrumentation().context.resources.assets.list("")
resources
assets
InstrumentationRegistry.getInstrumentation().context.resources.assets.list("")