title: Android ToggleButton always check
body: <p>I want to store in SharedPreferences if the toggle button is Checked or uncheck.</p>
  
  <pre><code> toggle.setOnCheckedChangeListener(new OnCheckedChangeListener(){
           public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
  
  if(isChecked){             
      SharedPreferences.Editor editor = getSharedPreferences("SharedPrefName", MODE_PRIVATE).edit();
     editor.putBoolean("check", true);
        editor.commit();
  
      } 
  else   {
    SharedPreferences.Editor editor = getSharedPreferences("SharedPrefName", MODE_PRIVATE).edit();
     editor.putBoolean("nocheck", false);
     editor.commit();
  }
  }});
  </code></pre>
  
  <p>But when I test this, it is always set to check
  in <code>OnCreate()</code> I added this:</p>
  
  <pre><code>SharedPreferences preferences = getSharedPreferences("SharedPrefName", MODE_PRIVATE);
      boolean value1 = preferences.getBoolean("check", true);  
  
      if (value1 = sharedPrefs.getBoolean("check", true)){
          psw.setChecked(value1);
      }else  {
          psw.setChecked(false);
      }
  </code></pre>