protected void animate() {          // TODO Auto-generated method stub 
        ImageView img = (ImageView) findViewById(R.id.image_view); 
        img.setBackgroundResource(R.drawable.frame_animation); 
        img.setVisibility(ImageView.VISIBLE); 
 
        AnimationDrawable anim = (AnimationDrawable) img.getBackground(); 
 
        if(anim.isRunning()){ 
            anim.stop(); 
        } 
        else{  
            anim.stop(); 
            anim.start(); 
        } 
    }