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

  • Home
  • SEARCH
  • 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 8231335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:27:08+00:00 2026-06-07T17:27:08+00:00

I am having ListView with SimpleCursorAdapter Error I am getting :- java.lang.IllegalStateException: The content

  • 0

I am having ListView with SimpleCursorAdapter

Error I am getting:-

java.lang.IllegalStateException: The content of the adapter has
changed but ListView did not receive a notification. Make sure the
content of your adapter is not modified from a background thread, but
only from the UI thread. [in ListView(2131361944, class
android.widget.ListView) with Adapter(class
com.pocketpharmacist.adapter.DrugClassesListAdapter)]

When:-

In my Fragment I have enabled the filtering with the adapter, and to filter the List I got one EditText.

Now,
1) when I start entering the text for filter Virtual Keyboard comes alive, and It starts filtering with the list

2)but, the real filtering comes alive when i hides the Keybord. and If i click on listItem with the keybord alive it gives me the above error, which is obvious because data is not reflected to UI

After going in to deep I got to know that for example I want to search ABCDE in a list I have entered ABC in Edittext now when i add D it shows me the filter for ABC and now again if I add E it shows me the filter for ABCD, Buuut Data is originally changed in the background. which is the cause of error.

But I am not able to figure out how to solve this

notifyDataSetChangedhas no effects, please Help me with this, any hint or idea can work

Hear is my code

Method from TextWatcher

public void afterTextChanged(Editable s) {
    searchAdapter.getFilter().filter(s.toString());
    searchAdapter.notifyDataSetChanged();
    drugListView.requestLayout();       
}

Logcat is as below

06-30 18:14:54.299: E/AndroidRuntime(6922): FATAL EXCEPTION: main
06-30 18:14:54.299: E/AndroidRuntime(6922): java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. [in ListView(2131361944, class android.widget.ListView) with Adapter(class com.pocketpharmacist.adapter.DrugClassesListAdapter)]
06-30 18:14:54.299: E/AndroidRuntime(6922):     at android.widget.ListView.layoutChildren(ListView.java:1555)
06-30 18:14:54.299: E/AndroidRuntime(6922):     at android.widget.AbsListView$CheckForTap.run(AbsListView.java:2840)
06-30 18:14:54.299: E/AndroidRuntime(6922):     at android.os.Handler.handleCallback(Handler.java:587)
06-30 18:14:54.299: E/AndroidRuntime(6922):     at android.os.Handler.dispatchMessage(Handler.java:92)
06-30 18:14:54.299: E/AndroidRuntime(6922):     at android.os.Looper.loop(Looper.java:132)
06-30 18:14:54.299: E/AndroidRuntime(6922):     at android.app.ActivityThread.main(ActivityThread.java:4028)
06-30 18:14:54.299: E/AndroidRuntime(6922):     at java.lang.reflect.Method.invokeNative(Native Method)
06-30 18:14:54.299: E/AndroidRuntime(6922):     at java.lang.reflect.Method.invoke(Method.java:491)
06-30 18:14:54.299: E/AndroidRuntime(6922):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
06-30 18:14:54.299: E/AndroidRuntime(6922):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
06-30 18:14:54.299: E/AndroidRuntime(6922):     at dalvik.system.NativeStart.main(Native Method)

Thank you

  • 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-06-07T17:27:10+00:00Added an answer on June 7, 2026 at 5:27 pm

    I have changed the method for filtration instead of writing

    public void afterTextChanged(Editable s) {
        searchAdapter.getFilter().filter(s.toString());
        searchAdapter.notifyDataSetChanged();
        drugListView.requestLayout();       
    }
    

    I have changed it and start using FilterListener
    and called notifyDataSetChanged in that method and now everything works like charm

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

Sidebar

Related Questions

Having ListView but I can customizing it only by modifying layout.xml (it's our system
Hi I'm having problem refreshing my listview after Async operation. I have a simplecursoradapter,
I am having ListView control which has button collections inside itemtemplate and want to
I am having a listview inside a scrollview , but the problem is that
Im trying to display hyperlinks (formated as hyperlink) in a listview row but not
I am having an Activity where I am having a ListView , but on
I'm having a ListView with my own custom adapter derived from a BaseAdapter .
I'm having a few problems getting my listview to show up in a simple
Im having a problem with my ListView adapter, Everything is being parsed VIA json
I'm having some minor problems with my listview. Every item has some information and

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.