How to access Switch button that is declared in MainActivity(layout) in BroadcastReceivers
问题 I have a task in which i have to change state of Switch button when airplane mode is ON/OFF. I have a main activity in which i declared Switch Button and i want to Change the state on/off of Switch from BroadcastReceiver Class Receiver public class MyReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { boolean isAirplaneModeOn = intent.getBooleanExtra("state", false); if(isAirplaneModeOn){ What Should i do ? } } } layout_main_activity <?xml