title: How to save the checkbox state? - android
body: <p>Ya there are plenty of questions and answers about this stuff in the net but i just can't figure out how to save the checkbox state using sharedpreference. Someone just help me with the coding part which i was not able to do.</p>
  
  <pre><code>ch = (CheckBox) findViewById(R.id.checkBox1);
  
      ch.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {
              // TODO Auto-generated method stub
          if(ch.isChecked())
                  {
              Toast.makeText(getApplicationContext(), "Check", Toast.LENGTH_SHORT).show();
              }
          else
          {
              Toast.makeText(getApplicationContext(), "Uncheck", Toast.LENGTH_SHORT).show();
          }}
      });
      }
  </code></pre>