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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:55:21+00:00 2026-05-25T15:55:21+00:00

I’ve got two competing problems. Situation Got a Massive Listview 10k+ items that I’m

  • 0

I’ve got two competing problems.

Situation

Got a Massive Listview 10k+ items that I’m trying to filter via an EditText on change.

Error 1

ANR keyDispatchingTimedOut error

I had the filtering operation on the UI thread (which seamed reasonable at the time), and I assume that is what is causing the error on some phones…

Attempted fix for Error 1

Created an AsyncTask specifically for calling my filter function…

    /// <summary>
    /// Implementation of Android AsyncTask to perform the StudentFiltering in background
    /// </summary>
    internal class FilterStudentsTask : AsyncTask
    {
        private Student[] _students;
        private StudentList _outer;
        private StudentListAdapter _adapter;
        private string _filterText;

        public FilterStudentsTask(StudentList outer, StudentListAdapter adapter, string filterText)
        {
            this._outer = outer;
            this._adapter = adapter;
            this._filterText = filterText;
        }

        protected override Java.Lang.Object DoInBackground(params Java.Lang.Object[] @params)
        {
            // filter the list
            this._adapter.filterStudents(this._filterText);
            return true;
        }

        protected override void OnPostExecute(Java.Lang.Object result)
        {
            // Notify adapter of Data Change (to trigger re-draw)
            this._adapter.NotifyDataSetChanged();
            base.OnPostExecute(result);
        }
    }

Error 2

So now, because I’ve got another thread taking care of the filtering, it’s not telling me I should not use background threads for this type of operation, and it should only happen on the UI thread..????

E/AndroidRuntime( 9738): FATAL EXCEPTION: main
E/AndroidRuntime( 9738): java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sur
e the content of your adapter is not modified from a background thread, but only from the UI thread. [in ListView(2131361885, class mapdroid.ColorFade
ListView) with Adapter(class mapdroid.StudentList_StudentListAdapter)]
E/AndroidRuntime( 9738):        at android.widget.ListView.layoutChildren(ListView.java:1510)
E/AndroidRuntime( 9738):        at android.widget.AbsListView.onLayout(AbsListView.java:1260)
E/AndroidRuntime( 9738):        at android.view.View.layout(View.java:7175)
E/AndroidRuntime( 9738):        at android.widget.RelativeLayout.onLayout(RelativeLayout.java:912)
E/AndroidRuntime( 9738):        at android.view.View.layout(View.java:7175)
E/AndroidRuntime( 9738):        at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
E/AndroidRuntime( 9738):        at android.view.View.layout(View.java:7175)
E/AndroidRuntime( 9738):        at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
E/AndroidRuntime( 9738):        at android.view.View.layout(View.java:7175)
E/AndroidRuntime( 9738):        at android.view.ViewRoot.performTraversals(ViewRoot.java:1140)
E/AndroidRuntime( 9738):        at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
E/AndroidRuntime( 9738):        at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 9738):        at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 9738):        at android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime( 9738):        at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 9738):        at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 9738):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime( 9738):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime( 9738):        at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(  111):   Force finishing activity MapDroid.MapDroid/mapdroid.StudentList
W/ActivityManager(  111): Activity pause timeout for HistoryRecord{40670aa0 MapDroid.MapDroid/mapdroid.StudentList}

Am I missing something but do these Errors seem to be in conflict? how do you reconcile them?

  • 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-25T15:55:22+00:00Added an answer on May 25, 2026 at 3:55 pm

    I think that problem is here

    protected override Java.Lang.Object DoInBackground(params Java.Lang.Object[] @params)
        {
            // filter the list
            this._adapter.filterStudents(this._filterText);
            return true;
        }
    

    You are not able acces Apapter class from not UI thread. Try to do something like this

    protected override Java.Lang.Object DoInBackground(params Java.Lang.Object[] @params)
        {
            // filter the list
            result = students.filterStudents(this._filterText);
            return true;
        }
    
    
    protected override void OnPostExecute(Java.Lang.Object result)
            {
                // Notify adapter of Data Change (to trigger re-draw)
                this._adapter.SetItems(result);
                this._adapter.NotifyDataSetChanged();
                base.OnPostExecute(result);
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
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
I have a French site that I want to parse, but am running into
i got an object with contents of html markup in it, for example: string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

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.