android assets 读图片

/**使用**/

bgimg0 = getImageFromAssetsFile("Cat_Blink/cat_blink0000.png");

/**
* 从Assets中读取图片
*/
private Bitmap getImageFromAssetsFile(String fileName)
{
Bitmap image = null;
AssetManager am = getResources().getAssets();
try
{
InputStream is = am.open(fileName);
image = BitmapFactory.decodeStream(is);
is.close();
}
catch (IOException e)
{
e.printStackTrace();
}

return image;

}

posted @ 2012-05-18 00:22  风吹倒了蕉  阅读(176)  评论(0编辑  收藏  举报