Java tutorial
//package com.java2s; import android.content.Context; import java.io.IOException; import java.io.InputStream; public class Main { public static String getFromAssets(Context context, String fileName) { String result = ""; try { InputStream in = context.getResources().getAssets().open(fileName); result = inputStream2String(in); } catch (Exception e) { e.printStackTrace(); } return result; } public static String inputStream2String(InputStream in) throws IOException { StringBuffer out = new StringBuffer(); byte[] b = new byte[4096]; for (int n; (n = in.read(b)) != -1;) { out.append(new String(b, 0, n)); } return out.toString(); } }