Thursday, August 9, 2012

[android-developers] Can a folder be created using instrumentation context instead of target context?

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:
File dir = getInstrumentation().getTargetContext().getDir("directory", MODE_WORLD_READABLE);  // Works, but this creates the folder in the target app.

File dir = getInstrumentation().getContext().getDir("directory", MODE_WORLD_READABLE);  // Does not work, the exists() returns false.

Thoughts?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate