You should not use raw to save images, used drawable o asset ;)
Loading a file from res folder in android test project
-
11-07-2023 - |
Question
In a testcase I need to load a picture which is available in my testproject in the folder
/myproject/res/drawable-hdpi/attachment.png
I tried it already by using the InstrumentationTestCase and storing the file in the /res/raw folder and loading it with this, but the R file does not contain my attachment.png
Context testContext = getInstrumentation().getContext();
InputStream input = testContext.getResources().openRawResource(R.raw.?????????)
any idea?
thanks
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow