0

Possible Duplicate:
Maintain/Save/Restore scroll position when returning to a ListView

how to save scroll position in the ListView? I should to add elements into the head of the ListView and into an arbitrary position, but visual part should NOT be scrolled.

for example I have 123 elements, I see 1/2 part of the element with index 66 (elements have a different height). I added an element into the list, and I should to see 1/2 part of the element with index 67 (previously index 66).

you can see as example - default "SMS" application for windows phone 7.5. This application uses the lazy-loading

0

1 Answer 1

0

you can use getSelection() and setSelection() method

Get the current selection using getSelection() and when you comes back to that ListView again the call setSelection()

Sign up to request clarification or add additional context in comments.

2 Comments

it's not worked for me... android 2.3.3
Sorry, it's worked, if I use this setter as myListView.post(new Runnable ...setSelection()...);. but after the notifyDataChanged scroll setted into the 0 position (visually), and setted to my position later. scroll position will not be stored :(

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.