I'm working on an application that primarily consists of a list view.
It's backed up by my own custom array adapter whose size changes every
5 seconds. If I scroll through the list view as the array adapter
changes from a greater size to a lesser size, I get an out of bounds
exception. It makes sense to me why this occurs (since I'm scrolling
at a position beyond the new array size), but I was wondering if there
was a good way to debug it. I can't seem to come to a clear
conclusion, and I was wondering if I could get some help.

I update the adapter using the following asyncTask...

public class myTask extends AsyncTask<Void, Void, Void>{

        @Override
        protected Void doInBackground(Void... params) {
            while(isRunning){
                myData.clear();
                getData();
                publishProgress();
                SystemClock.sleep(5000);
            }
            return null;
        }

        protected void onProgressUpdate(Void...progress){
            listAdapter.notifyDataSetChanged();

        }
}

myData is the ArrayList that supports listAdapter and getData() is the
function that populates myData with the relevant info that will
eventually be displayed in my list view.

Is there a good way to tackle this problem? For instance, should I try
to momentarily disable scrolling when going from larger to smaller, or
should I try to take care of it from the adapter's perspective?

Regards

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to