title: Checkbox inside the Fragment - capturing checks/unchecks
body: <p>I'm trying to recieve checkbox choices inside my Fragment class, however I'm not able to use the way I've used in Activities (calling <code>android:onClick="onCheckboxClicked"</code> method from a <code>layout.xml</code>), because I get the "method onCheckboxClicked not found" everytime this method is called.</p>
  
  <pre><code>public void onCheckboxClicked(View view) {
      // Is the view now checked?
      boolean checked = ((CheckBox) view).isChecked();
  
      // Check which checkbox was clicked
      switch(view.getId()) {
          case (R.id.checkBox_wifi):
              if (checked)    {
                  editor.putBoolean("wifi_on_off", true);
              }
              else    {
                  editor.putBoolean("wifi_on_off", false);
              }
              break;
  
      }
  
      editor.apply();
  }
  </code></pre>
  
  <p>So, I've implemented the View.OnClickListener, but this doesn't get any checkbox checks/unchecks:</p>
  
  <pre><code> @Override
  public void onClick(View view) {
      switch (view.getId()) {
          case R.id.checkBox_wifi:
              boolean checked = ((CheckBox) view).isChecked();
  
              if (checked) {
                  editor.putBoolean("wifi_on_off", true);
              } else {
                  editor.putBoolean("wifi_on_off", false);
              }
  
              editor.apply();
              break;
  
      }
  }  
  </code></pre>