static { try { if (mDefaultBitmap == null) { mDefaultBitmap = DemoUtils.decodeStream( CCPAppManager.getContext().getAssets().open("avatar/default_nor_avatar.png"), ResourceHelper.getDensity(null)); } } catch (IOException e) { } }
/** * 查找头像 * * @param username * @return */ public static Bitmap getPhoto(String username) { try { if (photoCache.containsKey(username)) { return photoCache.get(username); } Bitmap bitmap = DemoUtils.decodeStream( CCPAppManager.getContext().getAssets().open("avatar/" + username), ResourceHelper.getDensity(null)); photoCache.put(username, bitmap); return bitmap; } catch (IOException e) { } return mDefaultBitmap; }