Android AnimationDrawable - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android AnimationDrawable class.

This code example shows how to use the following methods: getDuration, getNumberOfFrames, start
	} 
 
	@Override 
	public void onWindowFocusChanged(boolean hasFocus) {
	  if (hasFocus && mAnimation != null) {
		  mAnimation.start();
		  mKillActivityHandler.sleep(mAnimation.getDuration(0) * mAnimation.getNumberOfFrames());
	  } 
	} 
	 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: start
            mAnim.stop();
        } 
        if (drawable instanceof AnimationDrawable) {
            mAnim = (AnimationDrawable)drawable;
            if (isShown()) {
                mAnim.start();
            } 
        } else { 
            mAnim = null;
        } 
    } 
 
    @Override 
    public void setImageDrawable(Drawable drawable) {
        super.setImageDrawable(drawable);
        updateAnim(); 
    } 
 
    @Override 
    @android.view.RemotableViewMethod 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: isRunning, stop
        // 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);
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: start, stop
             
            @Override 
            public boolean onTouch(View v, MotionEvent event) {
                ImageView iv = (ImageView) v;
                AnimationDrawable ad = (AnimationDrawable) iv.getDrawable();
                ad.stop();
                ad.start();
                return true; 
            } 
        }); 
    } 
} 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: start
            mAnim.stop();
        } 
        if (drawable instanceof AnimationDrawable) {
            mAnim = (AnimationDrawable)drawable;
            if (isShown()) {
                mAnim.start();
            } 
        } else { 
            mAnim = null;
        } 
    } 
 
    @Override 
    public void setImageDrawable(Drawable drawable) {
        super.setImageDrawable(drawable);
        updateAnim(); 
    } 
 
    @Override 
    @android.view.RemotableViewMethod 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android AnimationDrawable Questions & Answers:

See Code Examples for Android AnimationDrawable Methods: