Java tutorial
//package com.java2s; //License from project: Apache License 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 getStringFromFile(Context context, String fileName) throws IOException { InputStream inputStream = context.getAssets().open(fileName); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); StringBuilder sb = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { sb.append(line).append('\n'); } return sb.toString(); } }