title: How to change ToggleButton state programmatically?
body: <p>I have a ToggleButton defined like this:</p>
  
  <pre><code>&lt;ToggleButton android:text="ToggleButton" android:id="@+id/toggle"
      android:layout_height="wrap_content" android:layout_width="fill_parent"&gt;&lt;/ToggleButton&gt;
  </code></pre>
  
  <p>And I want to change its state programmatically. I tried using the <code>setChecked</code> and <code>toggle</code> methods, but neither of those works in my situation.</p>
  
  <p>I have an ongoing notification and when my activity receives the notification intent, the 
  toggle button should be set to not checked, but it's not working.</p>
  
  <p>I'm doing this on the activity's <code>onResume</code>. The code is being executed but the ToggleButton's state doesn't change.</p>
  
  <p>Weirdly, if I call <code>setChecked(false)</code> on the activity's <code>onCreate</code> it does changes the button's state, but not on <code>onResume</code>. What am I missing?</p>
  
  <p>Thanks.</p>