Java tutorial
//package com.java2s; import android.content.res.AssetManager; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { /** * Loads the contents of a file in the assets directory as a string. Use '/' as separator. * * @param assetManager assetManager * @param assetFileName assetFileName (relative path to asset file from assets folder) * @return The string contents of the asset * @throws IOException Any problem loading asset */ public static String loadAssetAsString(AssetManager assetManager, String assetFileName) throws IOException { BufferedReader reader = new BufferedReader( new InputStreamReader(assetManager.open(assetFileName), "UTF-8")); int character; StringBuilder builder = new StringBuilder(); do { character = reader.read(); if (character == -1) { break; } else { builder.append((char) character); } } while (true); return builder.toString(); } }