title: Android checkbox state inspection
body: <p>I am inspecting the state of a checkbox. I am using the code below. When app starts (checkbox is unchecked), toast message says "unchecked". But when i open another screen and then go back, it doesn't say anymore. How to do that?
  Partial code:</p>
  
  <pre><code> public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      cb1 = (CheckBox) findViewById(R.id.CheckBox01);
      if (cb1.isChecked())
      {
          Toast.makeText(main.this, "checked", Toast.LENGTH_SHORT).show();
      }
      else
      {
          Toast.makeText(main.this, "NOT checked", Toast.LENGTH_SHORT).show();
      }   
  </code></pre>
  
  <p>}</p>
  
  <p>In this code i also have a </p>
  
  <pre><code> cb1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) 
          {           
              //blablabla
          }
          });
  </code></pre>
  
  <p>part where i am inspecting the state of the checkbox when user clicks it.</p>
  
  <p>I want to inspect the state of checkbox every time this screen shows.</p>