ArrayList<String> checkedValue2;
i have a arrayList in which i add the checked value which working fine.checked/unchecked working fine but issue is when app restart the arrayList is empty.how to save the arraylist object .again when app restart and i check uncheck its value add remove. here is my code.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
checkedValue = new ArrayList<String>();
when i click on checkbox its value load to arraylist and when i uncheck the selected value remove when app restart the arraylist is empty plz tell me how to save arraylist aftar app restart.help me with some code
@Override
public void onItemClick(AdapterView<?> arg0, View v, int position, long arg3) {
// TODO Auto-generated method stub
cb = (CheckBox) v.findViewById(R.id.checkBox1);
TextView tv = (TextView) v.findViewById(R.id.textView);
pi = (ApplicationInfo) arg0.getItemAtPosition(position);
cb.performClick();
if (cb.isChecked()) {
checkedValue.add(tv.getText().toString());
itemCheckedd[position] = true;
// Toast.makeText(MainActivity.this, "all" + position, Toast.LENGTH_LONG).show();
} else if (!cb.isChecked()) {
checkedValue.remove(tv.getText().toString());
}
}