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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:38:52+00:00 2026-06-13T23:38:52+00:00

I’ve inherited some code with an expandable list view with a custom adapter. I’m

  • 0

I’ve inherited some code with an expandable list view with a custom adapter. I’m trying to figure out where the expand event is registered so I can trigger it using another component. I don’t see any listeners for the group in the expandablelistview. From what I can make out using print statements in the log, getGroupView() is getting called when I group is clicked. However, I don’t see where the method is called or how it get’s called.

Here’s the custom adapter class..

public class MyExpandableListAdapter extends BaseExpandableListAdapter {

        private String[][] teams;
        private String[] league;
        private final Context context;
        private ImageView imageViewUser;

        public MyExpandableListAdapter(String[] groups, String[][] children, Context context) {
            this.context = context;
            this.teams = children;
            this.league = groups;
        }

        public Object getChild(int groupPosition, int childPosition) {
            return teams[groupPosition][childPosition];
        }

        public long getChildId(int groupPosition, int childPosition) {
            return childPosition;
        }

         public int getChildrenCount(int groupPosition) {
         return teams[groupPosition].length;
         }

         public TextView getGenericView() {
             AbsListView.LayoutParams lp = new AbsListView.LayoutParams(
             ViewGroup.LayoutParams.FILL_PARENT, 64);

             TextView textView = new TextView(context);
             textView.setLayoutParams(lp);
             textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);

             textView.setPadding(56, 0, 0, 0);
             return textView;
         }
         public boolean areAllItemsEnabled() {
                return false;
            }
         public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View view, ViewGroup parent) {
             if (view == null) {
                    LayoutInflater inf = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
                    view = inf.inflate(R.layout.child_row, null);
                }
             view.setFocusable(false);
             view.setClickable(false);
             TextView textView = (TextView) view.findViewById(R.id.grp_child);
             textView.setFocusable(false);
             textView.setClickable(false);
             textView.setText(getChild(groupPosition, childPosition).toString());
             //final ImageView imageView;
             //imageView = (ImageView) view.findViewById(R.id.imageViewChild);
            // imageView.setImageResource(android.R.drawable.ic_menu_gallery);
             //imageView.setTag(new ChildPosition(groupPosition,childPosition));
             //imageView.setOnClickListener(new OnClickListener(){

                    /*public void onClick(View arg0) {
                        // TODO Auto-generated method stub
                        ChildPosition realPosition = (ChildPosition) imageView.getTag();
                        Log.d("Shimmer","Click" + "position: " + realPosition.mGroupPosition + " " + realPosition.mChildPosition);
                    }

                 });*/
             return view;
         }

         public Object getGroup(int groupPosition) {
             System.out.println("Group Clicked!S");

         return league[groupPosition];
         }

         public int getGroupCount() {
         return league.length;
         }

         public long getGroupId(int groupPosition) {
         return groupPosition;
         }

         public View getGroupView(int groupPosition, boolean isExpanded,View view, ViewGroup parent) {
             //TextView textView = getGenericView();

             System.out.println("I AM HERE!!!!");

             if (view == null) {
                    LayoutInflater inf = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
                    view = inf.inflate(R.layout.group_row, null);
                }
             TextView textView = (TextView) view.findViewById(R.id.row_name);
             textView.setText(getGroup(groupPosition).toString());
             final ImageView imageView;
             imageView = (ImageView) view.findViewById(R.id.imageView1);
             imageView.setImageResource(R.drawable.expand);
             imageView.setFocusable(false);
             imageView.setClickable(true);
             imageView.setTag(groupPosition);

             imageViewUser = (ImageView) view.findViewById(R.id.usericon);
             imageViewUser.setImageResource(R.drawable.user_one);

        /*   if (view == null) {
                    LayoutInflater inf = (LayoutInflater) this.getSystemService(this.LAYOUT_INFLATER_SERVICE);
                    view = inf.inflate(R.layout.expandlist_group_item, null);
                }*/


return view;
         }

public boolean isChildSelectable(int groupPosition, int childPosition) {
         return true;
         }
         public boolean hasStableIds() {
         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-13T23:38:53+00:00Added an answer on June 13, 2026 at 11:38 pm

    Did you try to simulate a click on the group as in:

    groupView.performClick();
    

    ?

    EDIT:

    public View getGroupView(int groupPosition, boolean isExpanded,View view, ViewGroup parent) {
        System.out.println("I AM HERE!!!!");
    
        ...
    
        if (groupPosition == thePositionIWantToAutomaticallyExpend) {
            view.post(new Runnable() {
                 @Override
                 public void run() {
                    view.performClick(); // This will simulate a user clicking on the view
                 }
            });
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have this code to decode numeric html entities to the UTF8 equivalent character.
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.