Java tutorial
//package com.java2s; import android.content.Context; import android.content.res.AssetManager; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static String getAssetFileContent(Context context, String assetFileName) { AssetManager assetManager = context.getAssets(); InputStream is = null; BufferedReader reader = null; String lineSeparator = System.getProperty("line.separator"); try { is = assetManager.open(assetFileName); reader = new BufferedReader(new InputStreamReader(is)); String line = null; StringBuilder sb = new StringBuilder(); while (((line = reader.readLine()) != null)) { sb.append(line).append(lineSeparator); } return sb.toString(); } catch (IOException e) { } finally { try { if (is != null) { is.close(); } if (reader != null) { reader.close(); } } catch (IOException e) { } } return null; } }