collect_app/src/main/java/org/odk/collect/android/activities/PrintFormInstanceActivity.java
private String GetStyleSheet(int fileId) {
        String strXsl = null;

        InputStream raw = getResources().openRawResource(fileId);
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        int size = 0;
        // Read the entire resource into a local byte buffer.
        byte[] buffer = new byte[1024];
        try {
            while ((size = raw.read(buffer, 0, 1024)) >= 0) {
                outputStream.write(buffer, 0, size);
            }
            raw.close();

            strXsl = outputStream.toString();

            Log.v("Log", "xsl ==> " + strXsl);
        } catch (IOException e) {
            e.printStackTrace();
        }

        return strXsl;

    }
/**
     * Read XSLT file from res/raw...
     **/
Read XSLT file from res/raw
Read XSLT file from res / raw
private String GetStyleSheet(int fileId) {
        String strXsl = null;
        InputStream raw = getResources().openRawResource(fileId);
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        int size = 0;
        byte[] buffer = new byte[1024];
        try {
            while ((size = raw.read(buffer, 0, 1024)) >= 0) {
                outputStream.write(buffer, 0, size);
            }
            raw.close();
            strXsl = outputStream.toString();
            Log.v("Log", "xsl ==> " + strXsl);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return strXsl;
    }
private String GetStyleSheet ( int fileId ) { String strXsl = null ; InputStream raw = getResources ( ) . openRawResource ( fileId ) ; ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( ) ; int size = 0 ; byte [ ] buffer = new byte [ 1024 ] ; try { while ( ( size = raw . read ( buffer , 0 , 1024 ) ) >= 0 ) { outputStream . write ( buffer , 0 , size ) ; } raw . close ( ) ; strXsl = outputStream . toString ( ) ; Log . v ( "Log" , "xsl ==> " + strXsl ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return strXsl ; }
Read XSLT file from res/raw...
Read XSLT file from res / raw ...
// Read the entire resource into a local byte buffer.