Code example for AnimationDrawable

Methods: getNumberOfFrames

0
			try 
			{ 
				Field field = AnimationDrawable.class
						.getDeclaredField("mCurFrame");
				field.setAccessible(true);
				// »ñÈ¡anim¶¯»­µÄµ±Ç°Ö¡ 
				int curFrame = field.getInt(anim);
				// Èç¹ûÒѾ­µ½ÁË×îºóÒ»Ö¡ 
				if (curFrame == anim.getNumberOfFrames() - 1)
				{ 
					// ÈøÃViewÒþ²Ø 
					setVisibility(View.INVISIBLE);
				} 
			} 
			catch (Exception e)
			{ 
			} 
			super.onDraw(canvas);
		} 
	} 
}