Code example for AnimationDrawable

Methods: isRunningstop

0
        // When the user clicks on the image, toggle the animation on/off 
        imageview.setOnClickListener(new View.OnClickListener() {
 
            @Override 
            public void onClick(View v) {
                if (animationDrawable.isRunning()) {
                    animationDrawable.stop();
                } else { 
                    animationDrawable.start();
                } 
            } 
        }); 
    } 
 
    /** 
     * The 'frames' in this app are nothing more than a gray background with text indicating 
     * the number of the frame. 
     */ 
    private BitmapDrawable getDrawableForFrameNumber(int frameNumber) {
        Bitmap bitmap = Bitmap.createBitmap(400, 400, Bitmap.Config.ARGB_8888);