assets文件夹资源的访问

访问assets文件夹中的文件,分为以下几个步骤:
1、在Activity里面调用getAssets(),获取AssetManager引用
2、调用AssetManager.open(String fileName)方法,指定读取的文件,得到输入流InputStream
3、用已经openfile的inputStream读取文件,读取完成后调用inputStream.close()关闭输入流
4、调用AssetManager.close()关闭AssetManager
注:来自assets中的文件只可以读取,而不能进行写的操作

posted @ 2015-04-13 23:39  算盘  阅读(367)  评论(0编辑  收藏  举报