笔记

来源:互联网 发布:java 垃圾回收 弱引用 编辑:程序博客网 时间:2024/05/28 15:49

itemImg.setImageBitmap(AndroidUtils.getAppIconFromAssets(TabMyLoveActivity.this, app.getAppIconName()));

============================================================================================


/**

* 获取assets中appicon中的icon图标
* @param _icon
* @return
*/
public static Bitmap getAppIconFromAssets(Context _context,String _icon){
Bitmap bitmap = null;
try{
if(_icon == null || _icon.trim().equals("")){
bitmap = BitmapFactory.decodeStream(_context.getResources().getAssets().open("appicon/default_icon.gif"));
}else{
bitmap = BitmapFactory.decodeStream(_context.getResources().getAssets().open("appicon/"+_icon));
}
}catch(Exception ex){
bitmap = null;
ex.printStackTrace();
}
return bitmap;
}
原创粉丝点击