If I'm not mistaken when the application remains open for a long time, the data will be released by the Android OS, and while the stopiong operation will call "onSaveInstanceState", and when can I save the searchritiera in this method and whether it will return when " onRestoreInstanceState "caused by?
private static SearchCriteria searchCriteria;
@Override
public void onSaveInstanceState(Bundle outState)
{
outState.putSerializable(WLConstants.SEARCH_CRITERIA, searchCriteria);
super.onSaveInstanceState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
if(savedInstanceState != null){
searchCriteria = (SearchCriteria)
savedInstanceState.getSerializable(WLConstants.SEARCH_CRITERIA);
}
super.onRestoreInstanceState(savedInstanceState);
}
d-man source
share