Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8022009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:09:00+00:00 2026-06-04T22:09:00+00:00

I have an expandablelistview with a checkbox by group and a checkbox by child.

  • 0

I have an expandablelistview with a checkbox by group and a checkbox by child.
when a group is checked/unchecked all the childs are checked/unchecked.I got no problem to with keep the state of this checkbox, but i want to force the expandableListView to redraw to show all the childs checkbox checked or unchecked immediately.
I search for hours and didn’t find solution.
Is anyone can explain me our to solve this problem, i ll be really glad.

here is the code where i manage the checkbox changes in my expandableListAdapter :

    public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {

    GroupViewHolder gholder;
    final TypeVehicule type=(TypeVehicule) getGroup(groupPosition);
    if (convertView==null)
    {
        gholder=new GroupViewHolder();
        convertView = inflater.inflate(R.layout.listevehicule_type,null);
        gholder.textViewGroup=(TextView)convertView.findViewById(R.id.LV_textType);
        gholder.checkType=(CheckBox)convertView.findViewById(R.id.LV_CheckType);
        gholder.checkType.setTag(groupPosition);        
        gholder.imgType=(ImageView)convertView.findViewById(R.id.LV_ImageType);
        convertView.setTag(gholder);
    }
    else
    {
        gholder = (GroupViewHolder)convertView.getTag();
    }
    gholder.textViewGroup.setText(type.getType());
        if (type.getColor()==-1)
        { 
            int color;
            Random rnd = new Random(); 
            color = Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));
            type.setColor(color);       
        }   
        gholder.imgType.setBackgroundColor(type.getColor());
        gholder.checkType.setChecked(type.isIschecked());

        gholder.checkType.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) 
            {                   
                type.setIschecked(((CheckBox) v).isChecked());

                    for (Vehicule _v : type.getListeVehicules())
                    {
                        _v.setIschecked(type.isIschecked());

                    }
            }       

        });

        gholder.checkType.setChecked(type.isIschecked());
      //
    return convertView;
}

and the code of the onCreate :

protected void onCreate(Bundle savedInstanceState) 
{
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(net.ornicar.ornimobile.R.layout.listevehicule);
    listView_Vehic = (ExpandableListView)findViewById(R.id.ListeVehicules);     
    // ici pour l'instant on rempli en dur en attendant l'implementation de la couche metier..      
    for (int i=1; i<10;i++)
    {
        TypeVehicule type = new TypeVehicule("Type " + i);

        ArrayList<Vehicule> oListVeh = new ArrayList<Vehicule>();

        for (int j=0;j<10;j++)
        {
            oListVeh.add(new Vehicule(type, "Veh N°"+j+"-"+i));
        }
        type.setListVehicule(oListVeh);
        oListType .add(type);           
    }
    ListeVehiculesAdapter adapter = new ListeVehiculesAdapter(this, oListType,true);
    listView_Vehic.setAdapter(adapter);
    this.registerForContextMenu(listView_Vehic);
    listView_Vehic.setOnChildClickListener(new  OnChildClickListener() {

        @Override
        public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { 
            Toast.makeText(getApplicationContext(), oListType.get(groupPosition).getListeVehicules().get(childPosition).getNom()+" Clicked!!", 4000).show();    
            return true;
        }
    });

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T22:09:01+00:00Added an answer on June 4, 2026 at 10:09 pm

    To force any (Expandable)ListView to redraw, you can call the notifyDataSetChanged on the Adapter used by the view. This will force a redraw on whatever is visible on screen. This means that your adapter must extend BaseAdapter or BaseExpandableListAdapter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If i have a expandablelistview with custom layout (group.xml and child.xml), the are any
I have an ExpandableListView backed by a BaseExpandableListAdapter. The child list items are all
I have problem in this layout that : it doesn't show any child after
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
I have the following problem: I would like to change value of ExpandableListView's cell
Have converted devise new session from erb to Haml but doens't work, this is
can we have ExpandableListView inside ListView so that I can have group level first
I have a ExpandableListView in which i am loading custom layouts in both group
ok so I have an ExpandableListView, I have defined all my views and everything
I have an ExpandableListView view and I've implemented OnChildClickListener , but I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.