Java tutorial
//package com.java2s; import android.content.Context; import android.content.res.Resources; public class Main { private static int sFadeInAnimationId = 0; private static int sFadeOutAnimationId = 0; private static int sSlideInRightAnimationId = 0; private static int sSlideOutRightAnimationId = 0; private static int sSlideInLeftAnimationId = 0; private static int sSlideOutLeftAnimationId = 0; private static int sSlideInTopAnimationId = 0; private static int sSlideOutTopAnimationId = 0; private static int sSlideInBottomAnimationId = 0; private static int sSlideOutBottomAnimationId = 0; public static void initializeAnimations(Context ctx) { Resources r = ctx.getResources(); sFadeInAnimationId = r.getIdentifier("fade_in", "anim", ctx.getPackageName()); sFadeOutAnimationId = r.getIdentifier("fade_out", "anim", ctx.getPackageName()); sSlideInBottomAnimationId = r.getIdentifier("slide_bottom_in", "anim", ctx.getPackageName()); sSlideOutBottomAnimationId = r.getIdentifier("slide_bottom_out", "anim", ctx.getPackageName()); sSlideInTopAnimationId = r.getIdentifier("slide_top_in", "anim", ctx.getPackageName()); sSlideOutTopAnimationId = r.getIdentifier("slide_top_out", "anim", ctx.getPackageName()); sSlideInLeftAnimationId = r.getIdentifier("slide_left_in", "anim", ctx.getPackageName()); sSlideOutLeftAnimationId = r.getIdentifier("slide_left_out", "anim", ctx.getPackageName()); sSlideInRightAnimationId = r.getIdentifier("slide_right_in", "anim", ctx.getPackageName()); sSlideOutRightAnimationId = r.getIdentifier("slide_right_out", "anim", ctx.getPackageName()); } }