public String readFileFromAssets(Context context, String fileName) throws IOException { if (null == context || null == fileName) return null; AssetManager am = context.getAssets(); InputStream input = am.open(fileName); ByteArrayOutputStream output = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int len = 0; while ((len = input.read(buffer)) != -1) { output.write(buffer, 0, len); } output.close(); input.close(); return output.toString(); }