Java tutorial
//package com.java2s; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import android.app.Activity; import android.content.res.AssetManager; import android.util.Log; public class Main { private static final String TAG = "ActivityUtil"; public static String loadAssetsText(Activity activity, String fileName, String charset) { return loadAssetsText(activity.getResources().getAssets(), fileName, charset); } public static String loadAssetsText(AssetManager assetManager, String fileName, String charset) { String text = null; try { BufferedReader br = new BufferedReader(new InputStreamReader(assetManager.open(fileName), charset)); StringBuilder sb = new StringBuilder(); while ((text = br.readLine()) != null) { sb.append(text); } text = sb.toString(); } catch (IOException e) { Log.e(TAG, e.getMessage(), e); } return text; } }