Create folder in toolkit context

I am writing control tests for my application and want to create a temporary folder to store some files. However, I do not want to do this in targetContext, but rather in a 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 tried a bunch of other things, it seems that the implementation of the Instrumentation context ignores these calls?

Thoughts?

+4
source share

All Articles