title: android gif animation and button
body: <p>I want to create an animate img, so when I click a button I can see the animation. 
  in my project, I've just create buttons and images. In the drawable folder, I put the three png images and a frame_animation.xml, I set the images and the duration. In the java file, I put this code: </p>
  
  <pre><code> button1.setOnClickListener(new View.OnClickListener(){
  
          public void onClick(View v){
              ImageView img = (ImageView)findViewById(R.id.imageView1);
              img.setBackgroundResource(R.drawable.frame_animation);
  
              myFrameAnimation=(AnimationDrawable) img.getBackground();
          }
      });
  </code></pre>
  
  <p>but when I run the app, the animation doesn't work (I can see only one image, not all the three image)</p>