Note that there are some explanatory texts on larger screens.

plurals
  1. POCheckbox auto call onCheckedChange when listview scroll?
    primarykey
    data
    text
    <p>I have a problem with listview which list item contain a checkbox. When i check a box and scroll list, checkbox sometime auto call oncheckedchange and value of checkbox is changed!</p> <p>Or, when my list has more than 9 or 10 item, then when i checked at item 1, item 8 or 9 is checked??? </p> <p>Anyone can tell me what do i fix this bug?</p> <p>Thanks in advance!</p> <p>list_item.xml</p> <p> </p> <p></p> <p></p> <pre><code>&lt;ImageView android:layout_alignParentLeft="true" android:layout_width="36dip" android:layout_height="36dip" android:layout_centerVertical="true" android:scaleType="fitCenter" android:id="@+id/image_view" android:src="@drawable/icon" /&gt; &lt;TextView android:layout_toRightOf="@id/image_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="5dip" android:id="@+id/text_view" android:lines="1" android:textSize="20sp" android:textColor="@color/white" /&gt; &lt;TextView android:layout_toRightOf="@id/image_view" android:layout_below="@id/text_view" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingLeft="5dip" android:id="@+id/text_view2" android:textSize="14sp" android:lines="1" android:textColor="@color/white" /&gt; </code></pre> <p> </p> <p>and here is adapter view:</p> <pre><code> public View getView(int position, View convertView, ViewGroup parent) { Log.e(TAG, "getView"); ViewHolder mViewHolder; if (convertView == null) { Log.e(TAG, "Inflater is inflating..."); convertView = mInflater.inflate(R.layout.custom_list_app, null); mViewHolder = new ViewHolder(); mViewHolder.checkbox = (CheckBox) convertView.findViewById(R.id.checkbox); mViewHolder.remove = convertView.findViewById(R.id.music_info); convertView.setTag(mViewHolder); } else { mViewHolder = (ViewHolder) convertView.getTag(); Log.e(TAG, "Position: " + position + " CheckBox: " + mViewHolder.checkbox.isChecked()); } mViewHolder.checkbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton cb, boolean flag) { // TODO Auto-generated method stub if (flag) { Log.d(TAG, "Checkbox checked"); } else { Log.d(TAG, "Checkbox un-checked"); } } }); return convertView; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload