Thanks Dianne, this helps.

On Thursday, August 9, 2012 11:34:25 PM UTC-7, Dianne Hackborn wrote:
>
> Not generally, when the instrumentation is running in the target process, 
> it is running under that uid.  You could do something like put a service or 
> content provider (or receiver) in your instrumentation apk that you can 
> interact with from the instrumentation code running in the app being tested.
>
> On Thu, Aug 9, 2012 at 11:15 AM, dnkoutso <[email protected] <javascript:>
> > wrote:
>
>> 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 
>> [email protected]<javascript:>
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>
>
>
> -- 
> Dianne Hackborn
> Android framework engineer
> [email protected] <javascript:>
>
> Note: please don't send private questions to me, as I don't have time to 
> provide private support, and so won't reply to such e-mails.  All such 
> questions should be posted on public forums, where I and others can see and 
> answer them.
>
>

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

Reply via email to