获取assets数据显示于TextView上
mTextView.setText(getFromAssets("shuoming.txt"));
---------方法
private CharSequence getFromAssets(String fileName) {
// TODO Auto-generated method stub
String result = "";
try {
InputStream in = getResources().getAssets().open(fileName);
// 获取文件的字节数
int lenght = in.available();
// 创建byte数组
byte[] buffer = new byte[lenght];
// 将文件中的数据读到byte数组中
in.read(buffer);
result = EncodingUtils.getString(buffer, ENCODING);
} catch (Exception e) {
e.printStackTrace();
}
return result;
}