我有一个很长的ListView,用户可以滚动。我每隔30秒刷新一次listview,listview刷新成功。但有一个问题,我希望列表滚动到刷新前的相同点。因为现在如果列表刷新,那么它显示第一个位置。刷新后listview显示第一个位置数据
我通过AsynchronousTask更新列表为:
private class HttpTask extends AsyncTask<String, Boolean, String> {
@Override
protected String doInBackground(String... params) {
System.out.println("inside doInBackground>>!!>>> ");
getResponse();
return "Executed";
}
@Override
protected void onProgressUpdate(Boolean... progress) {
}
@Override
protected void onPostExecute(String result) {
// publishProgress(false);
System.out.println("post excute funt***********");
setListAdapter(new ListAdapter(getApplicationContext(),
R.layout.mylist, dataArr));
}
}
任何帮助将是appreciated.Thanks提前
这可能会帮助你http://stackoverflow.com/questions/3014089/maintain-save-restore-scroll-position-when-returning-to-a-listview。 准确的事情你想要做的。 – NaviRamyle