Hi everyone,

I'm stuck on how to handle a child click with an expandable list view. Can
someone please point me in the right direction?

    [Activity(Label = "My Activity", MainLauncher=true)]
    public class ExpandListActivity : ExpandableListActivity
    {
        ServiceFactory sf = new ServiceFactory();
        private const String NAME = "NAME";
        string[] BlogNames = new string[] { "Blog One", "Blog Two" };

        BaseExpandableListAdapter mAdapter;

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            List<IDictionary<String, object>> groupData = new
List<IDictionary<String, object>>();
            List<IList<IDictionary<String, object>>> childData =
new List<IList<IDictionary<String, object>>>();
            for (int i = 0; i < BlogNames.Length; i++)
            {
                Dictionary&lt;String, object&gt; curGroupMap = new
Dictionary&lt;String, object&gt;();
                groupData.Add(curGroupMap);
                curGroupMap.Add(NAME, BlogNames[i]);

                List&lt;IDictionary&lt;String, object&gt;> children = new
List&lt;IDictionary&lt;String, object&gt;>();
                List<RssItem> RssItems = sf.GetNews(BlogNames[i], 10);
                for (int j = 0; j < RssItems.Count; j++)
                {
                    Dictionary&lt;String, object&gt; curChildMap = new
Dictionary&lt;String, object&gt;();
                    children.Add(curChildMap);
                    curChildMap.Add(NAME, RssItems[j].Title);
                }
                childData.Add(children);
            }

            // Set up our adapter
            mAdapter = new SimpleExpandableListAdapter(
                    this,
                    groupData,
                    Android.Resource.Layout.SimpleExpandableListItem1,
                    new String[] { NAME },
                    new int[] { Android.Resource.Id.Text1 },
                    childData,
                    Android.Resource.Layout.SimpleExpandableListItem2,
                    new String[] { NAME },
                    new int[] { Android.Resource.Id.Text1 }
                    );
            SetListAdapter(mAdapter);
        }
    }
Thanks,
:matt

--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/ExpandableListView-ChildClick-tp4841871p4841871.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to