图片
try {
InputStream in = this.getAssets().open("p002.bmp");
Bitmap bm = BitmapFactory.decodeStream(in);
in.close();
in = null;
iv.setImageBitmap(bm);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
文本文档
try {
InputStream fis = this.getAssets().open("jz.txt");
int count = fis.available();
byte[] bytes = new byte[count];
int len=0;
while((len=fis.read(bytes))!=-1){
System.out.println(len);
aa=aa+new String(bytes,0,len);
}
b.setText(aa);
fis.close();
fis = null;
} catch (IOException e) {
e.printStackTrace();
}
不要忘记加权限
