I am writing instrumentation tests for my app and want to create a temporary folder to store some files. However, I dont want to do that in the targetContext but rather in the test context.
In other words:
// Works, but this creates the folder in the target app.
File dir = getInstrumentation().**getTargetContext()**.getDir("directory", MODE_WORLD_READABLE);
// Does not work, the exists() returns false.
File dir = getInstrumentation().**getContext()**.getDir("directory", MODE_WORLD_READABLE);
I've tried a bunch of other stuff, it seems as if the Instrumentation
context
implementation ignores these calls?
Thoughts?