Android how can you implement moveToPosition with a Custom Adapter
I have a simple custom adapter. I need to set the starting position to different positions at different times. When using a standard listadapter, I can simply u开发者_C百科se myCursor.moveToPosition( i ). A custom adapter using getview does not work that way. Can anyone tell me how to move the current list to the position I want?
If your ListView is available, use: getListView().setSelection( i );
(or myListView.setSelection(i);
)
You can also get the current position (to return to in onResume, perhaps) by using:
int myPosition = getListView().getFirstVisiblePosition();
精彩评论