List of usage examples for android.content.res Resources getAnimation
@NonNull public XmlResourceParser getAnimation(@AnimatorRes @AnimRes int id) throws NotFoundException
From source file:android.support.graphics.drawable.AnimatorInflaterCompat.java
/** * Loads an {@link Animator} object from a resource, context is for loading interpolator. *//*from w ww . j a v a2s. c om*/ public static Animator loadAnimator(Context context, Resources resources, Theme theme, @AnimatorRes int id, float pathErrorScale) throws NotFoundException { Animator animator; XmlResourceParser parser = null; try { parser = resources.getAnimation(id); animator = createAnimatorFromXml(context, resources, theme, parser, pathErrorScale); return animator; } 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(); } }