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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:39:26+00:00 2026-05-29T07:39:26+00:00

I am populating an ExpandableListView from a sqlite table containing service call information. I

  • 0

I am populating an ExpandableListView from a sqlite table containing service call information. I want the parent group to be each unique service site and the child group to contain the call information for all calls at that site.

Site A
  Call 1
Site B
  Call 2

Instead, I’m getting:

Site A
  Call 1
  Call 2
Site B
  Call 1
  Call 2

Every service call is showing up under every site. I’ve been banging my head against the wall with ExpandableListViews for days now and the only code I’ve been able to use that hasn’t generated an onslaught of various errors or the app just crashing is

public class Today : ExpandableListActivity
{
   protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);

        SetContentView(Resource.Layout.Boards);

        List<IDictionary<string, object>> parent = new List<IDictionary<string,object>>();
        List<IList<IDictionary<string, object>>> child = new List<IList<IDictionary<string,object>>>();

        External inst = new External();
        var connection = inst.conn();
        var c = connection.CreateCommand();
        c.CommandText = "Select Distinct Store || ' ' || City || ', ' || State From Calls";
        connection.Open();
        SqliteDataReader dr = c.ExecuteReader();
        if (dr.HasRows)
            while (dr.Read())
            {
                Dictionary<string, object> pItem = new Dictionary<string,object>();
                pItem.Add("Store", dr[0].ToString());
                parent.Add(pItem);
            }
       dr.Close();
       int cnt = parent.Count();

       if (cnt > 0)
       {
           List<IDictionary<string, object>> children = new List<IDictionary<string, object>>();
           foreach(IDictionary<string, object> d in parent)
           {
               foreach (KeyValuePair<string, object> k in d)
               {
                   var store = k.Value.ToString().Substring(0, k.Value.ToString().IndexOf(" "));
                   c.CommandText = "Select CallNumber || ' ' || Description From Calls Where Store = '" + store + "'";
                   dr = c.ExecuteReader();
                   while (dr.Read())
                   {
                       Dictionary<string, object> childItem = new Dictionary<string, object>();
                       childItem.Add("Call", dr[0].ToString());
                       children.Add(childItem);
                   }
                   dr.Close();
                   child.Add(children);
               }

           }              
       }
       ExpandableListView view = (ExpandableListView)FindViewById(Android.Resource.Id.List);
       IExpandableListAdapter adapter = new SimpleExpandableListAdapter(this, parent, Android.Resource.Layout.SimpleExpandableListItem1, new string[] { "Store", "Call" }, new int[] { Android.Resource.Id.Text1, Android.Resource.Id.Text2 }, child, Android.Resource.Layout.SimpleExpandableListItem2, new string[] { "Store", "Call" }, new int[] { Android.Resource.Id.Text1, Android.Resource.Id.Text2 });
       view.SetAdapter(adapter);
    }

}
  • 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-29T07:39:27+00:00Added an answer on May 29, 2026 at 7:39 am

    You are adding the childItem to the same List (children) and then adding this list more than once on child.

    You must create a List<List<>> for every group on the ExpandableListView

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

Sidebar

Related Questions

I am populating textboxes with information from a particular node based on it's ConfirmNum
I am populating a table with query results and I want the style of
I'm populating a dropdownlist in c# asp.net-MVC from a SQL table using Linq2Sql. I'd
Im populating a GridView from List so am forced to use TemplateField controls to
im populating the data in the combo box using dataset tables...with some table name..now
I am populating different types objects with datarows with each attrivute of the relevant
I'm populating a ListView with items and add images from an ImageList (in the
I am populating a combobox dropdown with node fields from an Xml document. I
When populating the queue from the contents of the file, depth does not seem
When populating a textarea with special characters from a jQuery GET request, the special

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.