If the checkbox is checked I want to output text in another activity can save its state. I know I will need to put in a shared preferences somewhere but I'm new to this so I'm not sure how to do it
public class Bookingscreen extends AppCompatActivity {
CheckBox Lothianside;
CheckBox Mckeowns;
CheckBox Loch;
OnClickListener checkboxListener;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bookingscreen);
Lothianside =(CheckBox)findViewById(R.id.checkBox3);
Mckeowns =(CheckBox)findViewById(R.id.checkBox4);
Loch =(CheckBox)findViewById(R.id.checkBox5);
checkboxListener = new OnClickListener() {
@Override
public void onClick(View v) {
if (Lothianside.isChecked()){
}
if (Mckeowns.isChecked()){
}
if (Loch.isChecked()){
}
}
};
Lothianside.setOnClickListener(checkboxListener);
Mckeowns.setOnClickListener(checkboxListener);
Loch.setOnClickListener(checkboxListener);
}
}