Code example for Instrumentation

Methods: getContext

0
        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(assets.open(fileToStore.getName()));
            final FileOutputStream outputStream = closer.register(new FileOutputStream(fileToStore));
 
            ByteStreams.copy(inputStream, outputStream);
            outputStream.flush();
            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