Blackberry return to the previus position in ListField
In my application I'm using a list. This list can be updated by a refresh list button which is retriving more data from serever. When user pressing the refresh button, my application seves the last selected item into a memeber field -
lastPosition = listField开发者_如何转开发.getSelectedIndex();
After updating the list, my application uses -
listField.setSelectedIndex(lastPosition);
for setting the last position. But nothing happen.
How can i "move" the list's cursor to point on the lastPosition? Thanks, Eyal.
listField.setKeyword("");
listField.v = userVector;
listField.updateList();
listField.getResultList();
listField.setSelectedIndex(lastPosition);
listField.setFocus();
Manager manager = listField.getManager();
int rowHeight = listField.getRowHeight();
manager.setVerticalScroll(lastPosition * rowHeight);
listField.invalidate();
It's hard to guess what is wrong without seeing the code, however the first thing that comes to mind is probably you don't set focus on the list right after you restore the position? If you don't, then try it:
listField.setSelectedIndex(lastPosition);
listField.setFocus();
精彩评论