I have placed a switch widget in Main Activity, I also have a second activity that extends BroadcastReceiver. I want to get the boolean state of switch widget in second activity.
If I type
Switch s = (Switch) findViewById(R.id.switch1);
it says findViewById is undefined for the type SecondActivity. The problem is Android doesn't allow me to get the value of switch in a class that extends Broadcast Receiver.
I want to know the state of switch, i.e, whether switch is on or off, but in second activity. How can I achieve it?