Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid checkbox is not checked for custom listview when listview is in scrollview
    primarykey
    data
    text
    <p>i have implemented custom list view with check box and textviews. It is working fine when list view is not in scroll but if the rows are increased then listviews is in scroll view that time when i click on check box the checked mark is not staying. here is my code, Please suggest me if anything wrong in that code </p> <pre><code>public class ArchivedAdapter extends ArrayAdapter&lt;MessageBean&gt; { final ArrayList&lt;MessageBean&gt; updatedList = new ArrayList&lt;MessageBean&gt;(); private List&lt;MessageBean&gt; list; private TextView officenameView, sentOnView, messageView; public final static String MY_ACTION = "com.android.threeptalk.broadcast"; private boolean isDeleted = false; int count = 0; HashMap&lt;Integer, CheckBox&gt; checkList = new HashMap&lt;Integer, CheckBox&gt;(); public ArchivedAdapter(Context context, int resourseID, List&lt;MessageBean&gt; list) { super(context, resourseID, list); this.list = list; } @Override public int getCount() { return list.size(); } @Override public MessageBean getItem(int arg0) { return list.get(arg0); } @Override public long getItemId(int arg0) { return arg0; } @Override public View getView(final int position, View convertView, ViewGroup parent) { View row = convertView; LayoutInflater inflater = (LayoutInflater) this.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = inflater.inflate(R.layout.archievedmsgrow, parent, false); row.setId(position); Object obj = getItem(position); if (obj instanceof MessageBean) { final MessageBean message = (MessageBean) obj; CheckBox checkBox = (CheckBox) row.findViewById(R.id.checkBox); officenameView = (TextView) row.findViewById(R.id.officename); sentOnView = (TextView) row.findViewById(R.id.time); messageView = (TextView) row.findViewById(R.id.message); officenameView.setText(message.getOfficeName()); checkList.put(position, checkBox); checkBox.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { CheckBox c = (CheckBox) v; if (c.isChecked()) { c.setChecked(true); count++; updatedList.add(message); } else { c.setChecked(false); count--; updatedList.remove(message); updatedList.size()); } checkedCount(count, updatedList); } }); row.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { rowclicked(message, position); } }); sentOnView.setText(Common.getAppropriateTimeUsingTimeZone(message .getmDate())); if (message.getMessage() != null) { messageView.setText((message.getMessage())); } else { if (message.getMessageType().equals("OPTION")) { if (message.getOptions() != null &amp;&amp; message.getOptions().size() &gt; 0) { String data = message.getOptions().get(0); if (data != null &amp;&amp; !data.equals("")) { messageView.setText(data); } } } } } return row; } protected void messageSelected() { } protected void rowclicked(MessageBean message, int position) { // TODO Auto-generated method stub } protected void checkedCount(int count2, ArrayList&lt;MessageBean&gt; updatedList) { } } </code></pre> <p>`</p>
    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