Android examples for App:Assets File
Reads asset file from given name of the file
//package com.java2s; import java.io.InputStream; import android.content.Context; public class Main { /**/*from w ww. j a v a 2 s .com*/ * Reads asset file from given name of the file * @param fileName * @return */ public static String readAssetFile(Context context, String fileName) { InputStream file; try { file = context.getAssets().open(fileName); byte[] data = new byte[file.available()]; file.read(data); file.close(); return new String(data); } catch (Exception e) { } return ""; } }