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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:07:32+00:00 2026-05-29T08:07:32+00:00

This is as close as I’ve gotten to successfully populating an expandable listview from

  • 0

This is as close as I’ve gotten to successfully populating an expandable listview from a sqlite table.

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

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

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

       if (cnt > 0)
       {
           IList<IDictionary<string, object>> children = new IList<IDictionary<string, object>>();
           foreach(IDictionary<string, object> d in parent)
           {
               c.CommandText = "Select CallNumber From Calls Where Store = '" + d.Values + "'";
               dr = c.ExecuteReader();
               while (dr.Read())
               {
                   IDictionary<string, object> childItem = new IDictionary<string, object>();
                   childItem.Add("Call", dr[0].ToString());
                   children.Add(childItem);
               }
               dr.Close();
           }
           child.Add(children);
       }

       SimpleExpandableListAdapter adapter = new SimpleExpandableListAdapter(this, parent, Android.Resource.Layout.SimpleExpandableListItem1, new string[] { "Store" }, new int[] { Android.Resource.Id.Text1, Android.Resource.Id.Text2 }, child, Android.Resource.Layout.SimpleExpandableListItem2, new string[] { "CallNumber" }, new int[] { Android.Resource.Id.Text1, Android.Resource.Id.Text2 });
       SetListAdapter(adapter);
    }

}

This throws the following exceptions:

  • Cannot create an instance of the abstract class or interface ‘System.Collections.Generic.IDictionary<string,object>‘ X2
  • Cannot create an instance of the abstract class or interface ‘System.Collections.Generic.IList<System.Collections.Generic.IDictionary X2

These exceptions really don’t tell me why it can’t create those instances or give me any clue as to what I’m doing incorrectly.

  • 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-29T08:07:33+00:00Added an answer on May 29, 2026 at 8:07 am

    Those are build errors, not exceptions. The reason you’re getting them is that you can’t create an instance of an interface in C#. Instead you need to create an instance of an object that implements the interface you need. For example, using the ones in your code:

    IDictionary<string, object> pItem = new Dictionary<string,object>();
    
    IList<IDictionary<string, object>> children = new List<IDictionary<string, object>>();
    

    This is valid because Dictionary<TKey, TValue> implements IDictionary<TKey, TValue>, and List<T> implements IList<T>.

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

Sidebar

Related Questions

I hope this is close enough to programming to pass the bar :) Is
(Note: I realize this is close to How do you document your database structure?
This question comes close to what I need, but my scenario is slightly different.
This is probably close to trivial, but I can't find it. How can I
Although this question and this question are close to what I'm asking, I believe
I am using this function to close existing form and open a new form.
how can I make this jquery script close all previously opened children when entering
This SQL statement example is very close to what I think I need... update
According this MSDN article HttpApplication .EndRequest can be used to close or dispose of
In this sentence: myCommand.ExecuteReader(CommandBehavior.CloseConnection) does it close connection in case of exception?

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.