Reputation: 39
I got an Checkbox and I want that when someone click the checkbox in a other Activity an Text appeared...
I know how to make Listeners with Checkboxes and how to make a Text appear, but my App crashes when I click the CheckBox, so I think I need to make an thing that transfer the information that the CheckBox has been clicked to the other Activity... but How?
I tried to make make something with thes putExtras and getExtras, but I didnt found anything that helped!
Upvotes: 0
Views: 428
Reputation: 39
public void doSomethingWhenCheckBoxClicked(View v) {
boolean checked = ((CheckBox) v).isChecked();
switch (v.getId()) {
case R.id.checkBox1:
if (checked) {
Intent myIntent = new Intent(MainActivity2.this, MainActivity.class);
myIntent.putExtra("checked", true);
}
}
}
Upvotes: 1