Code example for Instrumentation

Methods: getContext

        return contentResolver.query(from, null, where, whereArguments, orderBy);
    private static void copyFileToSdCard(final File fileToStore, final Instrumentation instrumentation) {
        final Closer closer = Closer.create();
        final AssetManager assets = instrumentation.getContext().getResources().getAssets();
        try { 
            final InputStream inputStream = closer.register(;
            final FileOutputStream outputStream = closer.register(new FileOutputStream(fileToStore));
            ByteStreams.copy(inputStream, outputStream);
            assertTrue("Should exist: " + fileToStore, fileToStore.exists());
        catch (IOException e) {
            throw new RuntimeException(e);
Connect your IDE to all the code out there  Get Codota for Java