title: how to change the image on click of imagebutton?
body: <p>I am make a image button .I need to change the image when I click on image button .Actually it change the background image but only for few seconds .why ?</p>
  
  <p>here is my code</p>
  
  <pre><code> &lt;ImageButton android:id="@+id/favorite"
          android:layout_width="wrap_content"
          android:layout_height="fill_parent"
          android:src="@drawable/start"
          android:background="#00ffffff"
          /&gt;
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;item android:state_pressed="true"
          android:drawable="@drawable/on" /&gt; &lt;!-- pressed --&gt;
  
      &lt;item android:drawable="@drawable/off" /&gt; &lt;!-- default --&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p>I need to show on image when I click on image button ..? can I write on java side ? can I write on click listener of image button ?</p>