0

I'm new programming on Android and i stacked in (i think) a common problem. I have two activities and a CheckBox In one of those. What i need is when the CheckBox is selected and i click a button that changes to the second activity display the notifications.

  • possible duplicate of [How to start new activity on button click](http://stackoverflow.com/questions/4186021/how-to-start-new-activity-on-button-click) – MCLLC Jul 28 '15 at 00:21
  • What exactly do you mean by display the notifications on the second Activity? What notifications? – edwoollard Jul 28 '15 at 00:55

1 Answers1

0

What you can do is probably send a specific value if a specific checkbox is checked. like 1 for the 1st and 2 for the second you can include the string of check boxes checked in a string eg: 1246

After you use intent to call the other activity

Intent i = new Intent(FirstScreen.this, SecondScreen.class);   
i.putExtra( strName,"strval");
i.startActivity();

On the other side you could retrive the value inside strName to find out which checkboxes are checked

Intent intent = getIntent();
String xyz = intent.getStringExtra("strName");

check if str xyz contains (1)..if it does perform the action you want else check if it contains "2"

if(xyz.contains(1))
{
    //perform task 1
}
else if(xyz.contains(2))
{
    //perform task 2
}
Domain
  • 11,562
  • 3
  • 23
  • 44