标签:android io os ar sp 文件 on log bs
因为开发需要,经常要从工程的assets文件夹里面读取文件,现在贴一个方法以作记录:
private void getFromAssets(String fileName, ArrayList<String> nameSet){
try {
InputStreamReader inputReader = new InputStreamReader( getResources().getAssets().open(fileName) );
BufferedReader bufReader = new BufferedReader(inputReader);
String line="";
while((line = bufReader.readLine()) != null){
nameSet.add(line);
}
Log.i(TAG,"into getFromAssets nameList size is: " + nameSet.size() + " nameSet = " + nameSet);
bufReader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
标签:android io os ar sp 文件 on log bs
原文地址:http://www.cnblogs.com/wuqinghua/p/4067597.html