Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think the point is you only save checking state in the view(v.setSelected).</p> <p>And you reuse these view, so its checkbox is always not change its state.</p> <p>You can create a state array to save every checking state of every TaskInfo, and check this array when you create a view.</p> <p>for example</p> <pre><code>// default is false ArrayList&lt;Boolean&gt; checkingStates = new ArrayList&lt;Boolean&gt;(mListAppInfo.size()); @Override public View getView(final int position, View convertView, ViewGroup parent) { TaskInfo entry = mListAppInfo.get(position); if (convertView == null) { LayoutInflater inflater = LayoutInflater.from(mContext); convertView = inflater.inflate(R.layout.taskinfo,null); } ImageView ivIcon = (ImageView)convertView.findViewById(R.id.tmImage); ivIcon.setImageDrawable(entry.getIcon()); TextView tvName = (TextView)convertView.findViewById(R.id.tmbox); tvName.setText(entry.getName()); final CheckBox checkBox = (CheckBox)v.findViewById(R.id.tmbox); checkBox.setChecked(checkingStates.get(position)); convertView.setSelected(checkingStates.get(position)); convertView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if(v.isSelected()) { System.out.println("Listview not selected "); //CK.get(arg2).setChecked(false); checkBox.setChecked(false); v.setSelected(false); checkingStates.get(position) = false; } else { System.out.println("Listview selected "); //CK.get(arg2).setChecked(true); checkBox.setChecked(true); v.setSelected(true); checkingStates.get(position) = true; } } }); return convertView; } </code></pre>
 

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