Java tutorial
//package com.java2s; import android.content.Context; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static String getFileContents(Context context, int rawId) throws IOException { InputStream raw = context.getResources().openRawResource(rawId); BufferedReader buf = new BufferedReader(new InputStreamReader(raw)); StringBuilder content = new StringBuilder(); String line; while ((line = buf.readLine()) != null) { content.append(line); } buf.close(); return content.toString(); } }