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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:37:00+00:00 2026-05-26T06:37:00+00:00

I have discovered a few issues with ListViews in Mono for Android that may

  • 0

I have discovered a few issues with ListViews in Mono for Android that may be bugs. I have posted a fairly-simple project that demos both of these issues in more detail here:
Example Project

I’m wondering if I’m doing something wrong or if these are legitimate bugs.


First, if you try to use an inflated view as the footer view for a ListView by calling AddFooterView it throws a ClassCastException. Using a dynamically-created view works fine but you can’t apply styles to a dynamically created view.
So this works fine:

goodButton.Click += delegate {
    TextView tv = new TextView(this);
    tv.Text = "THIS IS THE LIST FOOTER";
    listView.AddFooterView(tv);
    listView.Adapter = adapter;
    Toast.MakeText(this, "Footer was added...", ToastLength.Short).Show();
};

But this throws ClassCastException:

TextView footerViewButton = FindViewById(Resource.Id.listFooterButton) as TextView;
badButton.Click += delegate {
    listView.AddFooterView(footerViewButton);
    listView.Adapter = adapter;
    Toast.MakeText(this, "Custom Footer was moved...", ToastLength.Short).Show();
};

Second, if you create a ListView and set an ItemClick handle, then call NotifyDataSetChanged() on the ListView the ItemClick event is no longer fired:

protected override void OnCreate(Bundle bundle) {
    base.OnCreate(bundle);
    SetContentView(Resource.Layout.ItemClick);
    ListView list = FindViewById(Resource.Id.itemClickList) as ListView;
    mAdapter = new CustomAdapter(this, Countries);
    list.Adapter = mAdapter;
    list.ItemClick += new EventHandler<ItemEventArgs>(list_ItemClick);
}

The CustomAdapter calls this method in the activity when the last view in the list is rendered:

public void GetMoreListItems() {
    if (mAdapter.Count < Countries.Length + MoreCountries.Length) {
        string[] allCountries = new string[Countries.Length + MoreCountries.Length];
        Countries.CopyTo(allCountries, 0);
        MoreCountries.CopyTo(allCountries, Countries.Length);
        mAdapter.NotifyDataSetChanged(allCountries);
        Toast.MakeText(this, "New items were loaded. Now Click action is broken.", ToastLength.Short).Show();
    }
}
  • 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-26T06:37:01+00:00Added an answer on May 26, 2026 at 6:37 am

    1) issue is not a bug. If you want to use styles for you footer view you can create xml layout for it and then use LayoutInflater to instantiate it and add as footer view to your list.

    var footerView = LayoutInflater.Inflate(Resource.Layout.footerView,null);
    listView.AddFooterView(footerView);
    

    2) I also had problem with it and i have spent some time trying to find the problem. After all i decided to ignore it and use NotifyDataSetChanged() method without parameters. And to update the adapter i have created method something like .SetItems(IEnumerable<TItem> items). So my code looks like this:

    var newItems=Service.LoadNewItems();
    adapter.SetItems(newItems);
    adapter.NotifyDataSetChanged();
    

    And all works fine for me. ListItemClick delegate is invoking.

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

Sidebar

Related Questions

A few quick searches discovered that I'm obviously not the first person to have
I have a Java library that uses a few things from the Android APIs.
I've discovered this folder in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files and have a few questions. What
I have discovered through trial and error that the MATLAB engine function is not
We have discovered that one of our auto generated assemblies is throwing a StackOverflowException
Recently I have discovered that my release executable (made with msvc++ express 2008) becomes
My testers have discovered that if you type free text into a file upload
While debugging an issue with our system, I have discovered a thread contention that
As well as my question Removing MKMapView Annotations causes leaks. I have discovered that
I have just discovered the nifty unhandled exception handler for cocoa-touch. Now that I

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.