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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:04:02+00:00 2026-05-27T20:04:02+00:00

I’m trying to make an Expandable ListView, but I don’t know how to retrieve

  • 0

I’m trying to make an Expandable ListView, but I don’t know how to retrieve the info of some methods from the ExpandableListAdapter, so here is my code:
This the Main Activity:

[Activity (Label = "AR Transactions Details")]          
public class ARInquiry : ExpandableListActivity
{
    private ARExpandableListAdapter adapter;
    private string[] groups = {"1","2","3","4"};
    private string[,] children = {
            { "Arnold", "Barry", "Chuck", "David" },
            {"Ace", "Bandit", "Cha-Cha", "Deuce"},
            { "Fluffy", "Snuggles", "", ""},
            { "Goldy", "Bubbles", "", "" }
    };

    protected override void OnCreate (Bundle bundle)
    {
        base.OnCreate (bundle);
        SetContentView(Resource.Layout.ar_inquiry);

        //Restrieve the ExpandableListView from the layout
        ExpandableListView listview = FindViewById<ExpandableListView>(Android.Resource.Id.List);

        //Initialize the adapter with blank groups and children
        //We will be adding children on a thread, and then update the ListView
        adapter = new ARExpandableListAdapter(this, groups, children);

        listview.SetAdapter(adapter);
    }
}

This is the ExpandableListViewAdapter Class Code:

public class ARExpandableListAdapter : BaseExpandableListAdapter
{
    private Context context;
    private string[] groups;
    private string[,] children;

    public ARExpandableListAdapter(Context context, string[] groups, string[,] children)
    {
        this.context = context;
        this.groups = groups;
        this.children = children;
    } 


    public override Java.Lang.Object GetChild (int groupPosition, int childPosition)
    {
        return children[groupPosition, childPosition];
    }

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

    public override View GetChildView (int groupPosition, int childPosition, bool isLastChild, View convertView, ViewGroup parent)
    {
        if(convertView == null)
        {
            LayoutInflater infaInflater = (LayoutInflater) context.GetSystemService(Context.LayoutInflaterService);
            convertView = infaInflater.Inflate(Resource.Layout.child_layout, null);
        }

        TextView tv = (TextView) convertView.FindViewById(Resource.Id.tvChild);
        if(isLastChild == true)
        {
          return convertView;   
        }
        tv.SetText(" " + children[groupPosition, childPosition], TextView.BufferType.Normal);

        return convertView;
    }

    public override int GetChildrenCount (int groupPosition)
    {
        return children[groupPosition, 3];
    }

    public override Java.Lang.Object GetGroup (int groupPosition)
    {
        return groups[groupPosition];
    }

    public override long GetGroupId (int groupPosition)
    {
        return groupPosition;
    }

    public override View GetGroupView (int groupPosition, bool isExpanded, View convertView, ViewGroup parent)
    {
        string _group = (string)GetGroup(groupPosition);
        if(convertView==null)
        {
            LayoutInflater infalInflater = (LayoutInflater) context.GetSystemService(Context.LayoutInflaterService);
            convertView = infalInflater.Inflate(Resource.Layout.group_layout, null);
        }
        TextView tv = (TextView)convertView.FindViewById(Resource.Id.tvGroup);
        tv.SetText(_group, TextView.BufferType.Normal);
        return convertView;
    }

    public override bool IsChildSelectable (int groupPosition, int childPosition)
    {
        return true;
    }

    public override int GroupCount {
        get {
            return groups.Count();
        }
    }

    public override bool HasStableIds {
        get {
            return true;
        }
    }


}

How can I retrieve the length of the GetChildrenCount Method?

  • 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-05-27T20:04:02+00:00Added an answer on May 27, 2026 at 8:04 pm

    I solve like this, cuz its working:

    public class ARExpandableListAdapter : BaseExpandableListAdapter
    {
    
        private Context context;
        private IList<string> groups;
        private IList<IAccountsReceivable> children;
    
        public ARExpandableListAdapter(Context context, IList<string> groups, IList<IAccountsReceivable> children)
        {
            this.context = context;
            this.groups = groups;
            this.children = children;
        } 
    
        #region implemented abstract members of Android.Widget.BaseExpandableListAdapter
        public override Java.Lang.Object GetChild (int groupPosition, int childPosition)
        {
    
            return (Java.Lang.Object)children[groupPosition]; //as Java.Lang.Object.JavaCast<decimal>();
        }
    
        public override long GetChildId (int groupPosition, int childPosition)
        {
            return childPosition;
        }
    
        public override View GetChildView (int groupPosition, int childPosition, bool isLastChild, View convertView, ViewGroup parent)
        {
            if(convertView == null)
            {
                LayoutInflater infaInflater = (LayoutInflater) context.GetSystemService(Context.LayoutInflaterService);
                convertView = infaInflater.Inflate(Resource.Layout.child_layout, null);
            }
    
            if(childPosition<6)
            {
                string label = " ";
                if (childPosition == 0)
                    label = children[groupPosition].TransactionType;
                if (childPosition == 1)
                    label = children[groupPosition].TransactionValue.ToString();
                if (childPosition == 2)
                    label = children[groupPosition].TransactionDate.ToString();
                if (childPosition == 3)
                    label = children[groupPosition].TransactionDueDate.ToString();
                if (childPosition == 4)
                    label = children[groupPosition].OrderNumber.ToString();
                if (childPosition == 5)
                    label = children[groupPosition].CustomerReference;
    
    
            TextView tv = (TextView) convertView.FindViewById(Resource.Id.tvChild);
            tv.SetText(" " + label, TextView.BufferType.Normal);
            }
            return convertView;
        }
    
        public override int GetChildrenCount (int groupPosition)
        {
            return children.Count;
        }
    
        public override Java.Lang.Object GetGroup (int groupPosition)
        {
            return groups[groupPosition];
        }
    
        public override long GetGroupId (int groupPosition)
        {
            return groupPosition;
        }
    
        public override View GetGroupView (int groupPosition, bool isExpanded, View convertView, ViewGroup parent)
        {
            string _group = (string)GetGroup(groupPosition);
            if(convertView==null)
            {
                LayoutInflater infalInflater = (LayoutInflater) context.GetSystemService(Context.LayoutInflaterService);
                convertView = infalInflater.Inflate(Resource.Layout.group_layout, null);
            }
            TextView tv = (TextView)convertView.FindViewById(Resource.Id.tvGroup);
            tv.SetText(_group, TextView.BufferType.Normal);
            return convertView;
        }
    
        public override bool IsChildSelectable (int groupPosition, int childPosition)
        {
            return true;
        }
    
        public override int GroupCount {
            get {
                return groups.Count();
            }
        }
    
        public override bool HasStableIds {
            get {
                return true;
            }
        }
        #endregion
    
    }
    
    • 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
For some reason, after submitting a string like this Jack’s Spindle from a text
Does anyone know how can I replace this 2 symbol below from the string
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
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
I want to count how many characters a certain string has in PHP, but
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:

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.