Reputation: 1759
I am writing some test case with AndroidTestCase. I want call getCacheDir to get the directory.
/data/data/com.mypackage/cache
But I have not start up the activity or application. it there any way I can get the activity or application context in AndroidTestCase.
Upvotes: 0
Views: 724
Reputation: 877
Since you are extending the AndroidTestCase, you can just use the call getContext() to retrieve the context. AndroidTestCase implements it for you.
Upvotes: 0
Reputation: 311
you can simply override getContext() in you subclass of AndroidTestCase
Upvotes: 1