title: android checkbox preference getting and setting the boolean values
body: <p>I am a beginner of the android and I try to making a simple flashlight app with preferences activity. So my problem is; I want to make light and sound settings are optional with checkboxes.</p>
  
  <p>settings.xml</p>
  
  <pre><code>  &lt;PreferenceCategory
       android:title="@string/sct_behaviour"&gt;
  
       &lt;CheckBoxPreference
         android:key="pref_light"
         android:title="@string/st_pref_light"
         android:summary="@string/ss_pref_light"
         android:defaultValue="true"
         /&gt;
      &lt;CheckBoxPreference
         android:key="pref_switch_sound"
         android:title="@string/st_pref_sound"
         android:summary="@string/ss_pref_sound"
         android:defaultValue="true"
         /&gt;
      &lt;CheckBoxPreference
         android:key="pref_notification_sound"
         android:title="@string/st_pref_notification_sound"
         android:summary="@string/ss_pref_notification_sound"
         android:defaultValue="true"
         /&gt;
  </code></pre>
  
  <p>settings.java</p>
  
  <pre><code>public class Settings extends PreferenceActivity{
  
  @SuppressWarnings("deprecation")
  @Override
  public void onCreate(Bundle savedInstanceState){
      super.onCreate(savedInstanceState);
      addPreferencesFromResource(R.xml.settings);
  
      CheckBoxPreference pLight = (CheckBoxPreference)getPreferenceManager().findPreference("pref_light");
  
      pLight.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
  
          @Override
          public boolean onPreferenceChange(Preference preference, Object newValue) {
  
              boolean myValue = (Boolean) newValue;
  
              if(myValue){
              }
  
                      //NEED SOME HELP IN THERE
  
  
              return true;
          }
      });
  </code></pre>
  
  <p>my turnOnFlash function;</p>
  
  <pre><code> private void turnOnFlash() {
      if (!isFlashOn) {
          if (camera == null || params == null) {
              return;
          }
  
          params = camera.getParameters();
          params.setFlashMode(Parameters.FLASH_MODE_TORCH);
          camera.setParameters(params);
          camera.startPreview();
          isFlashOn = true;
  
          // changing button/switch image
          toggleButtonImage();
  
       // play sound
          playSound();
      }
  }
  </code></pre>
  
  <p>onStart function</p>
  
  <pre><code>@Override
  protected void onStart() {
      super.onStart();
      if(VERBOSE) Log.v(TAG, "++ ON START ++");
      // on starting the app get the camera params
      getCamera();
  turnOnFlash(value);
  }
  </code></pre>
  
  <p>I want to set this true or false value to onStart cycle by the user choice. and don't know how to make this implementation. </p>