I ended up fixing this by moving my initialization loop from onCreate
to onResume and that worked.

On Nov 19, 3:03 pm, Armando <[EMAIL PROTECTED]> wrote:
> I achieved this by creating a custom Adapter. All you need to do is to
> create a new class that extends the BaseAdapter abstract class, then
> for the implementation you can take a look at the following sample
> from the API demos:
>
> http://code.google.com/android/samples/ApiDemos/src/com/example/andro...
>
> that example will show you how to set view elements in a custom list
> item.
>
> For this to work with the layout you're using you need to modify the
> getView method. I'll copy mine so you can get the idea.
>
> public View getView(int position, View convertView, ViewGroup parent)
> {
>   ViewHolder holder;
>
>   if (convertView == null) {
>     convertView = mInflater.inflate(
>       android.R.layout.simple_list_item_multiple_choice, null);
>
>     holder = new ViewHolder();
>     holder.checkbox = (CheckedTextView) convertView.findViewById
> (android.R.id.text1);
>
>     convertView.setTag(holder);
>   } else {
>     holder = (ViewHolder) convertView.getTag();
>   }
>
>   holder.checkbox.setText(tasks.get(position).getName());
>   holder.checkbox.setChecked(tasks.get(position).isCompleted());
>
>   return convertView;
>
> }
>
> static class ViewHolder {
>   CheckedTextView checkbox;
>
> }
>
> Hope this helps
> Armando
>
> On Nov 9, 5:30 am, songs <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I've got a multi-choice checkbox list being populated from a database
> > using the code below, but I can't figure out how to set the initial
> > checked state based on one of other columns.  Anyone know how to do
> > this?
>
> > ==============================
> > startManagingCursor(c);
> > setListAdapter(new SimpleCursorAdapter(this,
> >                         android.R.layout.simple_list_item_multiple_choice,
> >                         c,
> >                         new String[] {"title"},
> >                         new int[] {android.R.id.text1}));
> > ==============================
>
> > Thanks,
> > Steve
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to