List view back to top postion after updating data in arrayadapter
问题 I have a listview that refreshed every 5 secs, using a XML parsing. After refreshing, the current position of the list go back to first position. Is there any possible ways to solve this? 回答1: By using setAdapter() to update a list Android resets the position. Try altering the Adapter instead. I don't know which adapter you're using so here two examples. ArrayAdapter adapter = list.getAdapter(); if (adapter == null) { // Create new adapter + list.setAdapter() } else { adapter.clear(); adapter