how to maintain scroll position of listview when it updates

It is easier to maintain scroll position by calling notifydatasetchanged() only. The problem there is that you are creating a new adapter every time the data gets updated... you should do something like this:

if(listView.getAdapter()==null)
   listView.setAdapter(myAdapter);
else{
   myAdapter.updateData(myNewData);  //update adapter's data
   myAdapter.notifyDataSetChanged(); //notifies any View reflecting data to refresh
}

This way, your listview will mantain the scrolling position.

In case you want to scroll to a new position, use:

list.smoothScrollToPosition(int position);

In case for some reason you don't want to call notifyDataSetChanged(), the you can maintain the position by using setSelectionFromTop()

Before updating the adaptor:

lastViewedPosition = listView.getFirstVisiblePosition();

//get offset of first visible view
View v = listView.getChildAt(0);
topOffset = (v == null) ? 0 : v.getTop();

After updating the adaptor:

listView.setSelectionFromTop(lastViewedPosition, topOffset);