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
86
votes
10 answers

onCheckedChanged called automatically

I have a switch in a recyclerview and data is displayed in the recyclerview after retrieving data from DB. When the recyclerview is opened I read DB and if a field in DB is "Y" I enable the switch or else I disable the switch. Now the problem is…
64
votes
12 answers

Android - programmatically change the state of a switch without triggering OnCheckChanged listener

I'm looking for a method of programmatically changing the state of an Android Switch widget using switch.setChecked(true); without triggering OnCheckedChangedlistener. My first thought was to swap it out for an OnClickListener but as this only…
41
votes
8 answers

Radio button checked changed event fires twice

Please read my question its not a duplicate one. I've three radio buttons on windows form and all these buttons have common 'CheckedChanged' event associated. When I click any of these radio buttons, it triggers the 'CheckedChanged' event…
Muhammad Ali Dildar
  • 1,467
  • 6
  • 24
  • 35
34
votes
2 answers

OnCheckedChanged event not firing

I have a GridView with a column of checkboxes (the rest of the GridView is being populated from a database). I'm using AJAX to perform different functions, and I'm wondering if i'm just not calling the OnCheckedChanged event in the right place.…
Hani Honey
  • 2,101
  • 11
  • 48
  • 76
16
votes
2 answers

Using @OnCheckedChanged (ButterKnife) with radioGroup gives error in android

i recently integrated butterknife in my android project, and now i am trying to use @OnCheckedChanged annotation for radiogroup. but getting error of not giving callback. So what is the right method to call and get checkedId or this one is for…
Niki
  • 1,566
  • 1
  • 19
  • 36
13
votes
3 answers
10
votes
4 answers

how to add a listener for checkboxes in an adapter view, Android, ArrayAdapter, onCheckedChanged, OnCheckedChangeListener

I have a listView that by way of an ArrayAdapter is populated by small xml sub views. each small view only has two things inside, a checkbox and a string label next to it. i want to set an onCheckedChanged listener to capture the event of the user…
Kevik
  • 9,181
  • 19
  • 92
  • 148
9
votes
1 answer

OnCheckedChangeListener or OnClickListener with if statement for CheckBox's? What is the difference in functionality?

Hello I'm creating an android application that uses checkbox's, i'm wondering if it is better to use an OnCheckedChangeListener to do something when the state of the checkbox is changed or if it would be better to use an OnClickListener with an if…
Paul Alexander
  • 2,686
  • 4
  • 33
  • 69
5
votes
3 answers

onCheckedChanged event of checkbox within a gridview

I have a checkbox control in the gridview with Autopost back = true Code: ' runat="server" AutoPostBack="True" OnCheckedChanged="chkJobID_CheckedChanged" /> Now, when i check the checkbox the 'OnCheckedChanged' fires and…
Khushi
5
votes
3 answers

Android: When using setOnCheckedChangeListener on switches I get 'Cannot Resolve Symbol Error'

package com.example.koustav.myapplication; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Switch; import android.widget.TextView; import android.widget.CompoundButton; import…
5
votes
4 answers

OnCheckedChanged event not firing in GridView at all

I have a GridView with an asp CheckBox in a TemplateField. The TemplateField is defined as follows:
Adam
  • 255
  • 1
  • 3
  • 17
5
votes
4 answers

Can onCheckedChanged method be called with no interaction?

I have a custom ListView where clicking an item fires a new Activity. Each row of the ListView has a CheckBox and a TextView. This is the getView method from my custom ListView: public View getView(int position, View convertView, ViewGroup parent)…
eskalera
  • 1,072
  • 2
  • 21
  • 36
4
votes
1 answer

adding an event handler to a dynamically created checkbox (aspx, c#)

So my problem is that I want to add an event handler to a dynamically created CheckBox. I have already looked at other ways to do this, and decided that creating a dynamic table which contains my CheckBoxes is the best option for me. I have not…
Roman Hornich
  • 73
  • 1
  • 4
4
votes
3 answers

How to add switch button in navigation drawer

I want to use switch button in navigation drawer for adding and removing fragment from main layout. this my code- menuitem.xml`
4
votes
5 answers

How to flip the checked status of a Switch only after confirm dialog?

My problem is - when I click on a , it gets toggled first and then the OnCheckedChangeListener is called. What I would like is this: is clicked --> I show an AlertDialog --> If pressed yes or no --> Then flip ` with…
user1406716
  • 9,565
  • 22
  • 96
  • 151
1
2 3
8 9