You can create your own ListAdapter and then override the getViews
method to setup the checkboxes similar to this:
/* (non-Javadoc)
* @see android.widget.Adapter#getView(int, android.view.View,
android.view.ViewGroup)
*/
public View getView(int position, View convertView, ViewGroup parent)
{
Setup setup = (Setup)this.getItem(position);
if (convertView == null)
convertView = inflater.inflate(R.layout.setup_mgt_row,
null);
TextView textView = (TextView) convertView.findViewById
(R.id.setup_mgt_name);
textView.setText(setup.getName());
ImageView selectedView = (ImageView) convertView.findViewById
(R.id.setup_mgt_selected);
selectedView.setTag(position);
if(setup.isSelected())
selectedView.setImageState(new int[]
{ android.R.attr.state_checked }, true);
else
selectedView.setImageState(new int[]
{ android.R.attr.state_empty }, true);
selectedView.setOnClickListener(this);
ImageView deleteView = (ImageView)convertView.findViewById
(R.id.setup_mgt_delete);
deleteView.setTag(position);
deleteView.setOnClickListener(this);
return convertView;
}
Jeff
http://www.trackaroo.com
On Nov 28, 6:11 pm, Harry <[email protected]> wrote:
> I have a listview with some checkboxes.
> I want some of them to be prechecked when the activity starts.
> I have the positions of those checkboxes which needs to be pre
> selected.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en