assetsフォルダのファイル内容を取得
1763 ワード
/**
* @param fileName
* @return assets
*/
public String getFromAssets(Context context, String fileName) {
StringBuffer buffer = new StringBuffer();
try {
InputStream is = context.getResources().getAssets().open(fileName);
InputStreamReader inputReader = new InputStreamReader(is);
BufferedReader bufReader = new BufferedReader(inputReader);
String line = "";
while ((line = bufReader.readLine()) != null) {
buffer.append(line);
}
} catch (Exception e) {
e.printStackTrace();
}
return buffer.toString();
}