Code example for AnimationSet

Methods: addAnimation, setAnimationListener, setFillAfter

0
			AnimationListener listener, Boolean without) {
		// Find the center of the container 
		final float centerX = v.getWidth() / 2.0f;
		final float centerY = v.getHeight() / 2.0f;
 
		AnimationSet animeSet = new AnimationSet(true);
 
		if (without) {
			ScaleAnimation scale = new ScaleAnimation(1.4f, 1.4f, 1.4f, 1.4f,
					ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
					ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
			scale.setDuration(0);
			animeSet.addAnimation(scale);
		} else { 
			ScaleAnimation scale = new ScaleAnimation(1.4f, 1.4f, 1.4f, 1.4f,
					ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
					ScaleAnimation.RELATIVE_TO_SELF, 0.2f);
			scale.setDuration(0);
			animeSet.addAnimation(scale);
 
			TranslateAnimation tr = new TranslateAnimation(0, 0, 10, 10);
			tr.setDuration(0);
			animeSet.addAnimation(tr);
		} 
 
		// Create a new 3D rotation with the supplied parameter 
		// The animation listener is used to trigger the next animation 
		final Rotate3dAnimation rotation = new Rotate3dAnimation(start, end,
				centerX, centerY, 0f, true);
		rotation.setDuration(500);
		// rotation.setFillBefore(true); 
		// rotation.setInterpolator(new AccelerateInterpolator()); 
		// rotation.setAnimationListener(new DisplayNextView()); 
		animeSet.addAnimation(rotation);
 
		animeSet.setFillAfter(true);
		if (listener != null) {
			animeSet.setAnimationListener(listener);
		} 
 
		v.startAnimation(animeSet);
	}