title: Animated Image button that plays when clicked
body: <p>I am trying to create a media player and in that I want to make the <kbd>Play</kbd> button transform  to <kbd>Pause</kbd> button when clicked and again transform back to <kbd>Play</kbd> button when clicked again. It's a <code>.gif</code> image which I want to play forward upon first click and play backward upon second click. There are many tutorials about how to add an image as a button in android but none of them talks about button with animation that plays upon clicking. I am sure this is supported because I have seen similar applications. I want to know what is the correct way to do this? So it's not performance expensive and also works correctly regardless of the environment. Also I would appreciate a minimal example if possible.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>As a real close example to what I have in mind can be the Sony Xperia (Z1 or Z Ultra models to be specific) walkman app. This is a <a href="http://imgbin.org/index.php?page=image&amp;id=17494" rel="nofollow">sample</a> image to clarify things further.</p>