Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/201.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Android中加载所有测试资源而不使用名称?_Android_Testing_Instrumented Test - Fatal编程技术网

如何在Android中加载所有测试资源而不使用名称?

如何在Android中加载所有测试资源而不使用名称?,android,testing,instrumented-test,Android,Testing,Instrumented Test,在我的androidTest/resources目录中,我有几百张图像。我想在一个循环中读取它们,并针对特定的函数进行测试。我不想用他们的名字,因为我经常不认识他们。是否有可能通过正则表达式加载或遍历目录?我找到了一个解决方案。将目录名称从resources更改为assets,然后使用InstrumentationRegistry.getInstrumentation().context.resources.assets.list(“”)

在我的
androidTest/resources
目录中,我有几百张图像。我想在一个循环中读取它们,并针对特定的函数进行测试。我不想用他们的名字,因为我经常不认识他们。是否有可能通过正则表达式加载或遍历目录?

我找到了一个解决方案。将目录名称从
resources
更改为
assets
,然后使用
InstrumentationRegistry.getInstrumentation().context.resources.assets.list(“”)