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 8163611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:06:11+00:00 2026-06-06T19:06:11+00:00

I’m trying to create an expandable listview. The initial view with the groups shows

  • 0

I’m trying to create an expandable listview. The initial view with the groups shows up fine, the only problem is… nothing happens when I click on them. No expansion or anything. I’ve followed most of the tutorials I’ve seen and nothing has fixed it! Thanks for any help, here is the code I’m working with:

FeaturesAdapter:

package com.me.app;

import java.util.HashMap;
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.TextView;

public class FeaturesAdapter extends BaseExpandableListAdapter
{

private Context mContext;
private HashMap<String, List<String>> mFeatures = new HashMap<String, List<String>>();
private HashMap<Integer, String> mList = new HashMap<Integer, String>();

public FeaturesAdapter (Context con)
{
    mContext = con;
}

public boolean AddGroup(final String groupName, final List<String> features)
{
    final List<Feature> prev = mFeatures.put(groupName, features);

    if (prev != null)
        return false;

    mList.put(mFeatures.size() - 1, groupName);

    notifyDataSetChanged();
    return true;
}

@Override
public Object getChild(int groupPos, int childPos) 
{
    if (mList.containsKey(groupPos))
    {
        final String str = mList.get(groupPos);
        final List<Feature> data = mFeatures.get(str);

        return data.get(childPos);
    }

    return null;
}

@Override
public long getChildId(int groupPos, int childPos) 
{  
    return 0;
}

@Override
public View getChildView(int groupPos, int childPos, boolean isLastChild, View convertView, ViewGroup parent) 
{
    View rowView = convertView;
    FeatureView fView = null;
    int gPos = groupPos;
    int cPos = childPos;

    if (rowView == null)
    {
        LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);           
        rowView = inflater.inflate(R.layout.feature_row, null);

        fView = new FeatureView();
        fView.feature_name = (TextView) rowView.findViewById(R.id.feature_name);
        fView.feature_checked = (CheckBox) rowView.findViewById(R.id.feature_checked);

        rowView.setTag(fView);
    }
    else
        fView = (FeatureView) rowView.getTag();

    String str = mList.get(gPos);
    List<Feature> data = mFeatures.get(str);
    Feature feature = data.get(cPos);

    fView.feature_name.setText(feature.getName());
    fView.feature_checked.setChecked(feature.getChecked());
    int [] values = {gPos,cPos};
    fView.feature_checked.setTag(values);

    fView.feature_checked.setOnCheckedChangeListener(new OnCheckedChangeListener() 
    {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) 
        {
            doThings();             
        }
    });

    return rowView;
}

protected static class FeatureView {
    protected TextView feature_name;
    protected CheckBox feature_checked;
}

@Override
public int getChildrenCount(int groupPos) 
{
    if (mList.containsKey(groupPos))
        return mFeatures.get(mList.get(groupPos)).size();

    return 0;
}

@Override
public Object getGroup(int groupPos) 
{
    if (mList.containsKey(groupPos))
        return mFeatures.get(mList.get(groupPos));

    return null;
}

@Override
public int getGroupCount() 
{
    return mFeatures.size();
}

@Override
public long getGroupId(int groupPos) 
{
    return 0;
}

@Override
public View getGroupView(int groupPos, boolean isExpanded, View convertView, ViewGroup parent) 
{
    View rowView = convertView;
    FeatureView fView = null;
    int gPos = groupPos;

    if (rowView == null)
    {
        LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);           
        rowView = inflater.inflate(R.layout.group_row, null);

        fView = new FeatureView();
        fView.feature_name = (TextView) rowView.findViewById(R.id.group_name);
        fView.feature_checked = (CheckBox) rowView.findViewById(R.id.group_checked);

        rowView.setTag(fView);
    }
    else
        fView = (FeatureView) rowView.getTag();

    String str = mList.get(groupPos);
    List<Feature> data = mFeatures.get(str);

    fView.feature_name.setText(mList.get(groupPos));
    boolean flag = false;
    for (Feature feat : data)
    {
        if (feat.getChecked())
            flag = true;
    }
    fView.feature_checked.setChecked(flag);
    int[] values = {gPos};
    fView.feature_checked.setTag(values);

    fView.feature_checked.setOnCheckedChangeListener(new OnCheckedChangeListener() 
    {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) 
        {
            doOtherThings();
    });

    return rowView;
}

@Override
public boolean hasStableIds() 
{
    return false;
}

@Override
public boolean isChildSelectable(int groupPos, int childPos) 
{
    return false;
}
}

And here is my code in the actual file:

    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.feature_list);

    FeaturesAdapter adapter = new FeaturesAdapter(this);

    mBye.add("Cya");
    mBye.add("Bye");
    mBye.add("Adios");
    mBye.add("Goodbye");
    adapter.AddGroup("Bye", mBye);

    mStuff.add("Hi"));
    mStuff.add("Hey"));
    mStuff.add("Hello"));
    adapter.AddGroup("Salutations", mStuff);

    mSlang.add(new Feature("Yo"));
    adapter.AddGroup("Slang", mSlang);



    setListAdapter(adapter);
    ExpandableListView elv = getExpandableListView();
    elv.setTextFilterEnabled(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-06T19:06:12+00:00Added an answer on June 6, 2026 at 7:06 pm

    And we have a winner.
    If you have focusable elements within the ExpandableListView, you need to set android:focusable=”false” within their xml settings. Wohoo.

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;

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.