This can be a little confusing -- the Instrumentation class provides access
to two Contexts, one of the app being tested, and one of the instrumentation
itself.  You just want to get the instrumentation's context, and the asset
manager from that.

On Fri, Jul 3, 2009 at 4:59 PM, Jeremy Slade <[email protected]>wrote:

>
> I my main app and tests are organized like this (standard from
> "android create project ..."):
>
>  AndroidManifest.xml
>  assets/     -- main app asset files
>  src/
>  tests/
>        AndroidManifest.xml -- uses <instrumentation> to point to the
> main app
>        assets/  -- test-specific asset files
>        src/
>
> Writing test cases with AndroidTestCase, I'd like to load asset files
> from the test-specific assets/ directory, not from the main app
> assets/ directory.  How can I accomplish that?
>
> The normal way to load an asset would be getContext().getAssets().open
> ("foo.txt"), for assets/foo.txt in the main app.  I assume I just have
> to somehow change the Context or the AssetManager to point to the test-
> specific assets directory, but I don't see any way to do that.
>
> I have looked into the tests/bin/MyApp-debug.apk to confirm that the
> test assets are in there.  Now I just need a way to access them.
>
>
> Thanks,
> Jeremy
>
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

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