Multiple saved preferences in android
<p>I am very new to java and android but doing my best to make an app, basicaly I want a page with 6 text boxes on it, and each allows the user to type a 3 digit unique value into each, check a confirm box and then a button to save, then when the user revisits this part of the app the data will still be there, I managed to get it working for 1 box but if i add another it just duplicated box 1s value, here is my code for the class</p>

<p>public class Settings extends Activity implements OnClickListener {</p>

<pre><code>CheckBox cb;
EditText et, et1;
Button b;
String test;


@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.settings);

    cb = (CheckBox) findViewById(R.id.checkBox1);
    et = (EditText) findViewById(R.id.editText1);
    b = (Button) findViewById(R.id.button1);
    b.setOnClickListener(this);
    loadPrefs();
    cb.setChecked(false);       

}

private void loadPrefs() {

    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
    boolean cbValue = sp.getBoolean("CHECKBOX", false);
    String name = sp.getString("NAME", "Kg");
    if(cbValue){
        cb.setChecked(true);
    }else{
        cb.setChecked(false);
    }
    et.setText(name + (" kg"));
    }




private void savePrefs(String key, boolean value) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
    Editor edit = sp.edit();
    edit.putBoolean(key, value);
    edit.commit();
}

private void savePrefs(String key, String value) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
    Editor edit = sp.edit();
    edit.putString(key, value);
    edit.commit();
}

public void onClick(View v) {
    // TODO Auto-generated method stub
    savePrefs("CHECKBOX", cb.isChecked());
    if (cb.isChecked())
        savePrefs("NAME", et.getText().toString());

    finish();
}
</code></pre>

<p>}</p>

<p>any help would be greatly appreciated as time is short :(</p>
