title: How to keep switch setting in dialog?
body: <p>It's my problem.
  <a href="https://i.stack.imgur.com/W1aGM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/W1aGM.jpg" alt="enter image description here"></a></p>
  
  <p>This's my code:</p>
  
  <pre><code>dialog = new Dialog(FragmentOne.super.getActivity(),R.style.selectorDialog);
  dialog.setContentView(R.layout.dialog_mod);
         Switch switch1 = (Switch) dialog.findViewById(R.id.switch1);
                      switch1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                          @Override
                          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                              if (isChecked) {
                                  try {
                                  } catch (IOException e) {
                                      e.printStackTrace();
                                  } catch (XmlPullParserException e) {
                                      e.printStackTrace();
                                  }
                              } else {
                                  try {
                                  } catch (IOException e) {
                                      e.printStackTrace();
                                  } catch (XmlPullParserException e) {
                                      e.printStackTrace();
                                  }
                              }
                          }
                      });
  dialog.show();
  </code></pre>
  
  <p>Switch2 and Switch3 are same code as Switch1,so I pass this part.
  When I open again, it's reseted again.
  Any one know how to solve this?</p>