Questions tagged [oncheckedchanged]

Method to provide a callback when the checked state of a compound button changed in Android.

The onCheckedChanged is a static interface definition for a callback to be invoked when the checked state of a compound button (Checkbox, RadioGroup, etc.) changed:

onCheckedChanged(CompoundButton buttonView, boolean isChecked)  

which has these parameters:

  • buttonView: The compound button view whose state has changed.
  • isChecked: The new checked state of buttonView.

The Reference: CompoundButton.OnCheckedChangeListener
A sample from the Documentation: RenderScriptIntrinsic (MainActivity class)
Tags related: ,

131 questions
4
votes
6 answers

Checkbox default value & OnCheckedChangeListener

This is not so much of a problem but I am trying to find a correct way of doing this. I have the following situation: public class SettingsDialogFragment extends DialogFragment implements OnCheckedChangeListener { ... @Override public View…
Lieuwe
  • 1,734
  • 2
  • 27
  • 41
3
votes
1 answer

Check radio buttons status in Recycle View Adapter and applying changes to it from MainActivity

In my MainActivity method checkAnswer and showSolution are have to be modified because I added RecycleView adapter to the project and moved all view items to the QuestionAdapter. I do not understand how should I check status of rbGroup radio buttons…
3
votes
1 answer

onCheckedChanged not called on AppCompatCheckBox view

I create some custom checkbox views dynamically in code. Those checkboxes inherit from AppCompatCheckBox. public class ChangeableSelectionParameterValueCheckbox extends android.support.v7.widget.AppCompatCheckBox I add the OnCheckChangedListener…
3
votes
2 answers

Switch setOnCheckedChangeListener not working properly

I have a Switch named aSwitch. I have the following code in my setOnCheckedChangeListener : aSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton…
Sparker0i
  • 1,787
  • 4
  • 35
  • 60
3
votes
1 answer

create favourite button using toogleButton

i'm trying to add a favourite button using toogleButton that displays a certain icon when unchecked and another icon when checked. I tried this but isn't working. Here is the toggleButton
3
votes
1 answer

Placing a Drawable to the right of a button

Im working on an app that generates multiple choice questions. When user selected a button (radio button), it will put an image of X (if wrong) or V (if right) next to the selected answer. I created RadioGroup that contains all buttons and used…
baki1995
  • 83
  • 2
  • 9
3
votes
5 answers

How to on/off compount button programmatically without affecting the onCheckedChanged() in onCheckedChangeListener

I use a CompoundButton in my app. I call a method named newsLetterUpdate() in the onCheckedChange() callback of CompoundButton.OnCheckedChangeListener. I change the checked state of this CompoundButton programmatically, but the onCheckedChange()…
PK 7
  • 101
  • 1
  • 10
3
votes
4 answers

How to disable checkbox when a limit is reached in android?

I have 15 CheckBox and I must to stuck user when he checks more than 5. I use the method OnCheckedChangeListener to know if an item is checked, but I don't know how to limit after 5 items selected. See my code below: int lengthBox = 15; int…
Blo
  • 11,903
  • 5
  • 45
  • 99
3
votes
2 answers

How to add a listenner to a Switch Button?

Im trying to add a listenner to Switch but for some reason it does not listen to the check events. I implemented CompoundButton.OnCheckedChangeListener on my activity like this: public class MyActivity extends Activity implements…
meda
  • 45,103
  • 14
  • 92
  • 122
3
votes
1 answer

Listener for RadioButton for change Fragments

I need to switch fragments at the application with tabs (RadioButton). What is the event listener should I use? onClick or onCheckedChanged? If it is possible to example
Gend
  • 133
  • 3
  • 11
3
votes
1 answer

How to use switch statement with 'onCheckedChanged' method in android?

I have been trying for ages to get this to work and I want it so that I can put both checkedChanged in one OnCheckedChanged method. What I have so far doesn't work, but as I had it before with only one case, without the switch statement worked.…
James Meade
  • 1,147
  • 5
  • 22
  • 46
2
votes
2 answers

android checkbox onCheckedChanged is not invoked

I have defined onCheckedChanged for the checkbox in my listview. When i click on the check box to check / uncheck it this function is getting invoked. But when i setthe state of the check box from code like check.setChecked(true); the…
png
  • 4,368
  • 7
  • 69
  • 118
2
votes
1 answer

How to edit the checkedlist Recycler items along with newly selected items

I'm displaying a checked recyclerview in my edit details screen of application. When I go to edit screen I'm able to get the previously selected items are marked as checked working fine, but my challenge is I'm not able to edit the previously…
Dolly Rosy
  • 140
  • 10
2
votes
2 answers

RecycleView is blank. What do i miss?

I do not understand what do I miss in my prepareQuestion method. MainActivity starts but my RecycleView is empty. In the beginning In MainActivity I had question and radio buttons, when time ran out or "Confirm/Next" button is pressed next question…
2
votes
1 answer

Android Switch - how to toggle UI change before calling onCheckedChangeListener

I am doing heavy work in a Switch onCheckedChanged(CompoundButton buttonView, boolean isChecked) method. Namely I am doing Google Maps Cluster management (filter cluster items based on values). @Override public void onCheckedChanged(CompoundButton…
KasparTr
  • 2,328
  • 5
  • 26
  • 55
1
2
3
8 9