title: Android-Making checkbox state stable even after closing the application:
body: <p>I used onCheckedChanged method to handle the checkboxes.Its working well when i clicked.After leaving or closing the application and when i reopening it,the checkboxes state remains disabled.I want my checkboes state as i clicked(checked/unchecked) even after closing the application and reopening it.I tried using sharedpreferences posted here to achieve it.But as i am not cleared about it,i couldn't.</p>
  
  <pre><code>viewHolder.checkbox
                  .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
  
                      @Override
                      public void onCheckedChanged(CompoundButton buttonView,
                              boolean isChecked) {
  
  
                          Model element = (Model) viewHolder.checkbox
                                  .getTag();
                          element.setSelected(buttonView.isChecked());
  
  
     Interactivearrayadapter.this.putBooleanInPreferences(isChecked,"isChecked");
   }
    });
    }
  
   public void putBooleanInPreferences(boolean isChecked,String key){
      SharedPreferences sharedPreferences = this.getPreferences(Activity.MODE_PRIVATE);
      SharedPreferences.Editor editor = sharedPreferences.edit();
      editor.putBoolean(key, isChecked);
      editor.commit();        
  }
  public boolean getBooleanFromPreferences(String key){
      SharedPreferences sharedPreferences = this.getPreferences(Activity.MODE_PRIVATE);
      Boolean isChecked = sharedPreferences.getBoolean(key, false);
      return isChecked;   
  </code></pre>
  
  <p>I used this code inside Interactivearrayadapter class since i displayed checkboxes in a list.Error shows in getpreference(string) not support to this class.</p>