title: Set background programmatically by an xml file
body: <p>I have one <code>ImageButton</code> in my xml layout like that :</p>
  
  <pre><code>&lt;ImageButton android:id="@+id/tabsButton"
      android:background="@drawable/button" android:layout_height="48dp"       
      android:layout_width="48dp"&gt;&lt;/ImageButton&gt;
  </code></pre>
  
  <p>as you can see, I set the background of my ImageButton here :</p>
  
  <pre><code>   android:background="@drawable/button"
  </code></pre>
  
  <p>where button is an xml file that I placed in the drawable folder, below is the code of button.xml :</p>
  
  <pre><code> &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/duscrollover" /&gt; &lt;!-- pressed --&gt;
      &lt;item android:drawable="@android:color/transparent" /&gt; &lt;!-- default --&gt;
   &lt;/selector&gt;
  </code></pre>
  
  <p>until now, every thing is ok and works fine, but now I want to set the background of my ImageButton programmatically in my on create, so I did just this :</p>
  
  <pre><code>View myView  = findViewById(R.id.tabsButton);
  myView.setBackgroundResource(R.drawable.button);
  </code></pre>
  
  <p>But, it don't recognize button in myView.setBackgroundResource(R.drawable.button)
  So how can get the reference to an xml file witch is placed in drawable folder ?</p>
  
  <p>Thanks in advance </p>