It is woking fine for me.
paste onCreate code here to analyze your problem better.

On Mon, Aug 17, 2009 at 5:06 AM, frankjoshua <[email protected]> wrote:

>
> Has anyone tried this yet. I am getting strange results. When I click
> on one of the check boxes a second one will sometimes become checked
> also.
>
> On Aug 3, 1:04 am, powerbyte <[email protected]> wrote:
> > Hello Kostmo
> > use the following code to toggle check box
> >
> >  @Override
> >  public boolean onChildClick(ExpandableListView parent, View v, int
> > groupPosition, int childPosition, long id)
> >  {
> >         CheckedTextView tempView = (CheckedTextView)v.findViewById
> > (android.R.id.text1);
> >         tempView.setChecked(!tempView.isChecked());
> >         return super.onChildClick(parent, v, groupPosition,
> > childPosition, id);
> >  }
> >
> > On Jul 21, 11:16 am, "[email protected]" <[email protected]>
> > wrote:
> >
> > > You are using
> >
> > > final ListView listView = getExpandableListView();
> > >         listView.setItemsCanFocus(false);
> > >         listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
> >
> > > but you are extending ExpandableListActivity, not ListActivity. To use
> > > chekboxes properly you have to use mAdapter variable..
> >
> > > On Jul 14, 5:35 am, kostmo <[email protected]> wrote:
> >
> > > > I would like to haveexpandabletext categories which reveal children
> > > > that are checkable entries.
> > > > I've used the "simple_list_item_multiple_choice" layout for the
> > > > childLayout argument ofSimpleExpandableListAdapter.
> >
> > > > The activity shows up correctly, but when a child item is clicked,
> the
> > > > check box will not toggle.
> >
> > > > I haven taken code from List11.java and ExpandableList3.java from the
> > > > ApiDemos project.
> >
> > > > ====================================================
> > > > package com.kostmo.android.test;
> >
> > > > import java.util.ArrayList;
> > > > import java.util.HashMap;
> > > > import java.util.List;
> > > > import java.util.Map;
> >
> > > > import android.app.ExpandableListActivity;
> > > > import android.os.Bundle;
> > > > import android.widget.ExpandableListAdapter;
> > > > import android.widget.ListView;
> > > > import android.widget.SimpleExpandableListAdapter;
> >
> > > > public class ExpandableFeatureSelector extends ExpandableListActivity
> > > > {
> > > >     private static final String NAME = "NAME";
> >
> > > >     private ExpandableListAdapter mAdapter;
> >
> > > >     @Override
> > > >     public void onCreate(Bundle savedInstanceState) {
> > > >         super.onCreate(savedInstanceState);
> >
> > > >        List<Map<String, String>> groupData = new
> > > > ArrayList<Map<String, String>>();
> > > >        List<List<Map<String, String>>> childData = new
> > > > ArrayList<List<Map<String, String>>>();
> >
> > > >         for (String database_name : AvailableCategories) {
> > > >             Map<String, String> curGroupMap = new HashMap<String,
> > > > String>();
> > > >             groupData.add(curGroupMap);
> > > >             curGroupMap.put(NAME, database_name);
> >
> > > >            List<Map<String, String>> children = new
> > > > ArrayList<Map<String, String>>();
> > > >             for (String download_option : AvailableFeatures) {
> > > >                 Map<String, String> curChildMap = new HashMap<String,
> > > > String>();
> > > >                 children.add(curChildMap);
> > > >                 curChildMap.put(NAME, download_option);
> > > >             }
> > > >             childData.add(children);
> > > >         }
> >
> > > >         mAdapter = newSimpleExpandableListAdapter(
> > > >                 this,
> > > >                 groupData,
> > > >                 android.R.layout.simple_expandable_list_item_1,
> > > >                 new String[] { NAME },
> > > >                 new int[] { android.R.id.text1 },
> > > >                 childData,
> > > >                 android.R.layout.simple_list_item_multiple_choice,
> > > >                 new String[] { NAME },
> > > >                 new int[] { android.R.id.text1 }
> > > >                 );
> > > >         setListAdapter(mAdapter);
> >
> > > >         final ListView listView = getExpandableListView();
> > > >         listView.setItemsCanFocus(false);
> > > >         listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
> > > >     }
> >
> > > >     private static final String[] AvailableCategories = new String[]
> {
> > > >         "Books", "Clothes", "Cars"
> > > >     };
> >
> > > >     private static final String[] AvailableFeatures = new String[] {
> > > >         "Damaged", "Used"
> > > >     };
> >
> > > > }
> >
> > > > ====================================================- Hide quoted
> text -
> >
> > > - Show quoted text -
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to