I have a custom control that extends ListView. I want to add a custom code for my custom listview to set selection and want to do it once in all my code. Is there a method on the listview that is executed after onResume() of activity that holds the control.
I want to centralize my code in one place, that is ListView method that executes after the method below:
@Override
public void onResume()
{
super.onResume();
this._listItems.requestFocusFromTouch();
this._listItems.setSelection(StateManager.getCurrentState().getLastListViewPosition());
}
The point is so I don’t have ot do it in EVERY of over 100 screens I have but make this change in my custom listview.
Thank you in advance!
the only thing you would need to watch out for is the sorts and stuff. Because if you are doing that after the listview is loaded you will end up with your selection always at the top.