private Drawable loadDrawableForCookie(TypedValue value, int id, Resources.Theme theme) { if (value.string == null) throw new Resources.NotFoundException("Resource \"" + getResourceName(id) + "\" (" + Integer.toHexString(id) + ") is not a Drawable (color or path): " + value);
return originColorList; } catch (NotFoundException e) { e.printStackTrace(); L.e("resName = " + resName + " NotFoundException : "+ e.getMessage()); return trueColorList; } catch (NotFoundException e) { e.printStackTrace(); L.w("resName = " + resName + " NotFoundException :" + e.getMessage()); return originColorList; } catch (NotFoundException e) { e.printStackTrace(); L.w("resName = " + resName + " NotFoundException :" + e.getMessage());
/** * Loads an {@link Animator} object from a resource * * @param context Application context used to access resources * @param id The resource id of the animation to load * @return The animator object reference by the specified id * @throws android.content.res.Resources.NotFoundException when the animation cannot be loaded */ public static Animator loadAnimator(Context context, int id) throws NotFoundException { XmlResourceParser parser = null; try { parser = context.getResources().getAnimation(id); return createAnimatorFromXml(context, parser); } catch (XmlPullParserException ex) { Resources.NotFoundException rnf = new Resources.NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } catch (IOException ex) { Resources.NotFoundException rnf = new Resources.NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } finally { if (parser != null) parser.close(); } }
messageRecallInterval = RongContext.getInstance().getResources().getInteger(io.rong.imkit.R.integer.rc_message_recall_interval); } catch (Resources.NotFoundException e) { e.printStackTrace();
e.printStackTrace(); } catch (Resources.NotFoundException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace();
e.printStackTrace(); } catch (NotFoundException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace();
"drawable", requestItem.getCompanionEducationImageResourcePackage()))); } catch (Resources.NotFoundException nfe) { nfe.printStackTrace();
ex.printStackTrace(); return;
} catch (XmlPullParserException | IOException e) { final NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(e); throw rnf; } finally {
/** * Loads an {@link Animator} object from a resource * * @param context Application context used to access resources * @param id The resource id of the animation to load * @return The animator object reference by the specified id * @throws NotFoundException when the animation cannot be loaded */ public static Animator loadAnimator(Context context, int id) throws NotFoundException { XmlResourceParser parser = null; try { parser = context.getResources().getAnimation(id); return createAnimatorFromXml(context, parser); } catch (XmlPullParserException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } catch (IOException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } finally { if (parser != null) parser.close(); } }
/** * 获取状态栏高度 * * @param context 上下文 * @return 状态栏高度,如果界面没有呈现将返回0 */ public static int getStatusBarHeight(Activity context) { if (mStatusBarHeight <= 0) { Resources resources = context.getResources(); int resourceId = resources.getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) { try { mStatusBarHeight = resources.getDimensionPixelSize(resourceId); } catch (Resources.NotFoundException e) { e.printStackTrace(); } } // 直接获取失败,尝试从显示视图中获取,必须在界面显示之后才能获取到值 if (mStatusBarHeight <= 0) { Rect frame = new Rect(); context.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame); mStatusBarHeight = frame.top; } } return mStatusBarHeight; }
private void setDividerColor(NumberPicker picker, int color) { java.lang.reflect.Field[] pickerFields = NumberPicker.class.getDeclaredFields(); for (java.lang.reflect.Field pf : pickerFields) { if (pf.getName().equals("mSelectionDivider")) { pf.setAccessible(true); try { ColorDrawable colorDrawable = new ColorDrawable(color); pf.set(picker, colorDrawable); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (Resources.NotFoundException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } break; } } } }
/** * Set the background color of the header * * @param colorResId Resource Id of the color * @param drawableResId Resource Id of the drawable */ private void setHeaderBackground(int colorResId, int drawableResId) { if (drawableResId == -1) { try { header.setBackgroundColor(getResources().getColor(colorResId)); } catch (Resources.NotFoundException e) { e.printStackTrace(); } } else { try { header.setBackgroundDrawable(getResources().getDrawable(drawableResId)); } catch (Resources.NotFoundException e) { e.printStackTrace(); } } }
public static Animation loadAnimation(Context context, int id) throws Resources.NotFoundException { XmlResourceParser parser = null; try { parser = context.getResources().getAnimation(id); return createAnimationFromXml(context, parser); } catch (XmlPullParserException ex) { Resources.NotFoundException rnf = new Resources.NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } catch (IOException ex) { Resources.NotFoundException rnf = new Resources.NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } finally { if (parser != null) parser.close(); } }
public static Animation loadAnimation(Context context, int id) throws Resources.NotFoundException { XmlResourceParser parser = null; try { parser = context.getResources().getAnimation(id); return createAnimationFromXml(context, parser); } catch (XmlPullParserException ex) { Resources.NotFoundException rnf = new Resources.NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } catch (IOException ex) { Resources.NotFoundException rnf = new Resources.NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } finally { if (parser != null) parser.close(); } }
public static Animation loadAnimation(Context context, int id) throws Resources.NotFoundException { XmlResourceParser parser = null; try { parser = context.getResources().getAnimation(id); return createAnimationFromXml(context, parser); } catch (XmlPullParserException ex) { Resources.NotFoundException rnf = new Resources.NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } catch (IOException ex) { Resources.NotFoundException rnf = new Resources.NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } finally { if (parser != null) parser.close(); } }
private static Map<String, List<Animation<?, ?>>> loadAnimationMap( Context context, @AnimatorRes @AnimRes int id) throws NotFoundException { XmlResourceParser parser = null; try { parser = context.getResources().getAnimation(id); return createAnimatorFromXml( context, parser, Xml.asAttributeSet(parser), null, ORDERING_TOGETHER) .toMap(0); } catch (XmlPullParserException | IOException ex) { final NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); //noinspection UnnecessaryInitCause rnf.initCause(ex); throw rnf; } finally { if (parser != null) { parser.close(); } } }
/** 设置显示器选中以及未选中资源(for STYLE_DRAWABLE_RESOURCE) */ public T setIndicatorSelectorRes(int unselectRes, int selectRes) { try { if (mIndicatorStyle == STYLE_DRAWABLE_RESOURCE) { if (selectRes != 0) { this.mSelectDrawable = getResources().getDrawable(selectRes); } if (unselectRes != 0) { this.mUnSelectDrawable = getResources().getDrawable(unselectRes); } } } catch (Resources.NotFoundException e) { e.printStackTrace(); } return (T) this; }
private int getCorrectShape(Bundle bundle, Resources resources) { if (bundle != null) { int roundIcons = bundle.getInt(CALENDAR_ROUND_ICONS, 0); if (roundIcons != 0) { try { TypedArray obtainTypedArray = resources.obtainTypedArray(roundIcons); int resourceId = obtainTypedArray.getResourceId(dayOfMonth(), 0); obtainTypedArray.recycle(); return resourceId; } catch (Resources.NotFoundException e) { e.printStackTrace(); } } } return 0; }