title: How to set the state_pressed of a button
body: <p>I use a xml file to color my button. In the xml a have this code to define the color of my button when it's clicked.</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" &gt;
          &lt;shape&gt;
              &lt;gradient
                    android:startColor="@color/mainRaddoppiaButtonBackgroundEnd"
                  android:endColor="@color/mainRaddoppiaButtonBackgroundStart"
  
                  android:angle="270" /&gt;
              &lt;stroke
                  android:width="0dp"
                  android:color="@color/mainRaddoppiaButtonBackgroundStart" /&gt;
              &lt;corners
                  android:radius="3dp" /&gt;
              &lt;padding
                  android:left="10dp"
                  android:top="10dp"
                  android:right="10dp"
                  android:bottom="10dp" /&gt;
          &lt;/shape&gt;
      &lt;/item&gt;
  
      &lt;item android:state_focused="true" &gt;
             &lt;shape&gt;
              &lt;gradient
                    android:startColor="@color/mainRaddoppiaButtonBackgroundEnd"
                  android:endColor="@color/mainRaddoppiaButtonBackgroundStart"
  
                  android:angle="270" /&gt;
              &lt;stroke
                  android:width="0dp"
                  android:color="@color/mainRaddoppiaButtonBackgroundStart" /&gt;
              &lt;corners
                  android:radius="3dp" /&gt;
              &lt;padding
                  android:left="10dp"
                  android:top="10dp"
                  android:right="10dp"
                  android:bottom="10dp" /&gt;
          &lt;/shape&gt;
      &lt;/item&gt;
  
      &lt;item&gt;        
          &lt;shape&gt;
              &lt;gradient
                  android:startColor="@color/mainRaddoppiaButtonBackgroundStart"
                  android:endColor="@color/mainRaddoppiaButtonBackgroundEnd"
                  android:angle="270" /&gt;
              &lt;stroke
                  android:width="0dp"
                  android:color="@color/mainRaddoppiaButtonBackgroundStart" /&gt;
              &lt;corners
                  android:radius="3dp" /&gt;
              &lt;padding
                  android:left="10dp"
                  android:top="10dp"
                  android:right="10dp"
                  android:bottom="10dp" /&gt;
          &lt;/shape&gt;
      &lt;/item&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p>Is it possibile from java to keep my button pressed and color it with "state_pressed" values set in my xml file?</p>
  
  <p>Someting like: </p>
  
  <pre><code>  public void onClick(View button) {
       button.seLayout(R.xml.xmlFileName.state_pressed)
  }
  </code></pre>
  
  <p>Of course this code has no sense, i just made it up to let you understand what i want to do</p>