skip to Main Content

I have a CheckBox with an ID checkBox1, which will be controlled and set automatically. I would like to listen to the state of the CheckBox and change the position of a RadioButton with ID radioButton1 which is in different activity. I know how to display a text when the checkbox is clicked. Is there a way how to make the RadioButton listen to the state of the CheckBox?

Thank you

2

Answers


  1. Disclaimer: I have never used Android Studio or the Android SDK.

    I searched "android checkbox listener" on Google and this is the first result: https://developer.android.com/guide/topics/ui/controls/checkbox.

    To define the click event handler for a checkbox, add the android:onClick attribute to the element in your XML layout. The value for this attribute must be the name of the method you want to call in response to a click event. The Activity hosting the layout must then implement the corresponding method.

    Login or Signup to reply.
  2. there are many way to do that you can use broadcaster receiver, livedata, interface and intent . those are will work for you. try to implement interface it can be easier.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search