Maintain list position with custom adapter

Put your problem here if it does not fit any of the other categories.

Maintain list position with custom adapter

Postby twilbrand » Wed Sep 08, 2010 9:27 pm

I have a main listview that I want to update on a fixed schedule using a timer.

I have the timed updates working, but my problem is that the list is jumping back to the top every time the timed AsyncTask completes.

The list has a custom adapter that extends ArrayAdapter. The data is coming as JSON back from an HTTP GET request. I transform the JSON into an Array of objects, then do the following:

Code: Select all
MyListAdapter adapter = new MyListAdapter(someObjects);
setListAdapter(adapter);


I think the problem may lie in the fact that I'm using an array of objects rather than something like an ArrayList. However, I don't see an acceptable replacement for ArrayAdapter to have my custom adapter extend.

Again, the main goal is to allow my list to be updated every x seconds (10, 20, whatever) and not jump back to the top of the list every time.

I can post more code if needed.
twilbrand
Once Poster
Once Poster
 
Posts: 1
Joined: Wed Sep 08, 2010 9:12 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: MSNbot Media and 9 guests