Java tutorial
//package com.java2s; import android.content.res.Resources; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { static String readSharedFromRawResource(Resources resources, int resourceId) { final InputStream inputStream = resources.openRawResource(resourceId); final InputStreamReader inputStreamReader = new InputStreamReader(inputStream); final BufferedReader bufferedReader = new BufferedReader(inputStreamReader); StringBuilder body = new StringBuilder(); try { String nextLine; while ((nextLine = bufferedReader.readLine()) != null) { body.append(nextLine); body.append("\n"); } } catch (IOException e) { return null; } return body.toString(); } }