Android IDE (AIDE) Support Forum

Trigger a component which is from another activity in MainActivity

Hi there, there is a checkbox which is located in bottom_sheet_setting.xml. It will be shown by clicking the item of the spinner.
In activity_main.xml, there is a text input (edittext). I want the user can set the action for the text input like readonly and editable by clicking the checkbox. Like if it is checked then set the text input becomes disable.

However, the textinput is came from activity_main.xml and the checkbox is came from another activity e.g. bottom_sheet_setting.xml.
If I code it directly, it will prob be shown

Attempt to virtual method ... on a null object reference

Therefore, how can I click the checkbox to set the action of the text input? e.g. input.setEnabled(false); Note that they are came from different activities.


To communicate between activities in real time use interfaces