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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:25:30+00:00 2026-06-08T11:25:30+00:00

after some advice really. My app fills a list view on load using a

  • 0

after some advice really. My app fills a list view on load using a mediastore cursor. This is pulling music linked to user defined folder, which in most cases will be all of their stored music. I have one beta tester that is using an Archos Tablet with approximately 10000 songs on it, running android 2.2. While performance for most users is pretty slick, I wanted to improve the experience for users such as this.

The current process:

User loads app.
App finds default folder
App populates list view with music within and below that folder
User moves to a folder further down the tree, list view is repopulated based on the selected folder
User moves again….list is repopulated based on the selected folder…

So what I’m wondering is this – is it faster/more efficient to use the following process:
User loads app
App finds default folder
app populates list view with music within and below that folder
user moves to a folder within the tree, THE LIST IS FILTERED TO THAT FOLDER
if the user moves higher up the tree than the default data (i.e. potential for new files), the list view is repopulated, but only in this circumstance.

So basically,my questions is “how does filtering compare to repopulation?”

  • 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-08T11:25:33+00:00Added an answer on June 8, 2026 at 11:25 am

    A very good question. Let me try to answer this.

    Filtering is actually repopulation the ListView, whereas you create/get a new collection and tell the Adapter it’s content has changed by calling notifyDataSetChanged.

    The ‘heavy’ work for a listView is that getView call in it’s adapter. I’ve tested this myself, and if you inflate a new View every time getView is called, the performance drops. Heavenly.

    The ListView’s adapter is built so that already inflated views can be re-used, which tackles above named problem. Besides, only visible views are loaded, so it’s not like the Adapter is going to create 10000 views if you tell it’s collection is 10000 items big.

    notifyDataSetChanged will tell the adapter to rebuild the listviews content, but it still contains previously inflated views. So here is a big performance win.

    So my advice for you is, when you are using the same ‘row layout’ to just repopulate the ListView using notifyDataSetChanged. I’ve implemented this multiple times myself without noticing any UI performance issues. Just make sure to do the filtering of your collection an a background thread. (AsyncTask comes in handy here).

    One last tip: Do you have any phone thats quite old? Or someone you know does? Find the slowest phone you can and test your application on it for performance. I have a HTC Legend myself, which is outdated and slow if f*ck, but perfect for performance testing. If it runs on my (old) phone, it runs on any phone.

    Pseudo code sample if your applications flow:

    public class FolderListActivity extends Activity implements OnItemSelected {
    
        // NOTE: THIS IS PSEUDO CODE
    
        private ListView listView
        private Adapter adapter;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstaceState);
    
            // setContentView here 
            listView = (ListView)findViewById(R.id.your_listview_here);
            listView.setOnItemSelectedListener(this);
        }
    
        public class AsyncLoadMusicLocationTask extends AsyncTask<Void, Void, List<String>> {
    
            public List<String> doInBackground(Void... params) {
                // Load the information here, this happens in the background
                // using that cursor, i'm not sure what kind of things you are using
                // So I assumed a List of Strings
            }
    
            @Override
            public void onPostExecute(List<String> result) {
                // Here we have our collection that was retrieved in a background thread
                // This is on the UI thread
    
                // Create the listviews adapter here
                adapter = new Adapter(result, and other parameters);
                listView.setAdapter(adapter);
            }
        }
    
        @Override
        public void onItemSelect(Some params, not sure which) {
    
            // THIS SHOULD BE DONE ON THE BACKGROUND THE PREVENT UI PERFORMANCE ISSUES
    
            List<String> collection = adapter.getObjects();
            for (int i = 0; i < collection.size(); i++) {
                // Filter here
            }
    
    // this method will most probably not exist, so you will need to implement your own Adapter class
            adapter.setObjects(collections);
            adapter.notifyDataSetChanged();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

after some advice regarding a problem i am getting using a linux based piece
I'd really appreciate some advice around testing for errors using OCMock. Method Under Test
I am after some advice and pointers on integration testing for a web app.
Summary I am after some advice on the easiest way to analyze simple data
I'm after some design advice. I'm working on an application with a fellow developer.
I'm a newbie to Unit Testing and I'm after some best practice advice. I'm
Basically I'm after advice on producing dynamic PDFs with charts, images and some styling
I am after so advice really. I have been thinking about a client server
This was posted at Caliburn.Micro discussions also. I'm really looking for advice and opinions
Afternoon all - I'm after a bit of advice really. Being a newbie, 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.