title: Android setTextOn not working in onCheckChanged method
body: <p>These next two statements produce <em>correct</em> screen below left:</p>
  
  <pre><code>                if(isChecked) sw.setText   ("This switch is: On"); 
                  else          sw.setText   ("This switch is: Off"); 
  </code></pre>
  
  <p>According to the text I'm looking at, these next two statements <em>should</em> produce screen on left. But they produce <strong>incorrect</strong> screen below right:</p>
  
  <pre><code>                if(isChecked) sw.setTextOn ("This switch is: On"); 
                  else          sw.setTextOff("This switch is: Off"); 
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/2NpP5.png" alt="enter image description here">   <img src="https://i.stack.imgur.com/7eaTx.png" alt="enter image description here"></p>
  
  <p>The code:</p>
  
  <pre><code>package com.dslomer64.checkbox;
  
  import android.support.v7.app.ActionBarActivity;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.widget.CheckBox;
  import android.widget.CompoundButton;
  import android.widget.Switch;
  
  
  public class MainActivity extends ActionBarActivity{//} implements CompoundButton.OnCheckedChangeListener {
      CheckBox cb;
      Switch sw;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          cb = (CheckBox)findViewById(R.id.check);
          cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
              @Override
              public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                  if(isChecked)
                      cb.setText("checked");
                  else
                      cb.setText("Unchecked");
              }
          });
  
          sw = (Switch)findViewById(R.id.swish);
          sw.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
              @Override
              public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                  if(isChecked)
                      sw.setTextOn("This switch is: On"); ////////////
                  else
                      sw.setTextOff("This switch is: Off"); //////////
  
              }
          });
      }
  }
  </code></pre>
  
  <p>The xml:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  xmlns:tools="http://schemas.android.com/tools"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:paddingLeft="@dimen/activity_horizontal_margin"
                  android:paddingRight="@dimen/activity_horizontal_margin"
                  android:paddingTop="@dimen/activity_vertical_margin"
                  android:paddingBottom="@dimen/activity_vertical_margin"
                  tools:context=".MainActivity" android:weightSum="1"&gt;
  
      &lt;Switch
          android:layout_width="453dp"
          android:layout_height="100dp"
          android:id="@+id/swish"
          android:layout_gravity="center_vertical"
          android:layout_alignParentTop="true" android:layout_centerHorizontal="true"/&gt;
  
      &lt;CheckBox
          android:text="Unchecked"
          android:layout_width="200dp"
          android:layout_height="100dp"
          android:id="@+id/check"
          android:layout_centerVertical="true"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"/&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Is the book wrong about <code>setTextOn</code> and <code>setTextOff</code>? Do I have a problem in java code or xml?</p>