I have an Activity A which calls Activity B. In Activity B, when i click on a button, finish() is called, which in turn calls onDestroy() of Activity B and returns to activity A.
According to android documentation, Before onDestroy is called, onSaveInstanceState(Bundle bundle) will be called, where i do the following.
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
System.out.println("Saving webview state");
Log.d(TAG, "In onsave");
wv.saveState(outState);
}
and the next time Activity B is started from Activity A,
in the oncreate(), i do the following:
onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
if(savedInstanceState != null){
//restore webview
}else {
// code
}
}
However, before calling onDestroy in Activity B, The onSaveInstanceState method is never called.
any help on this will be greatly appreciated.
EDIT: if this is not possible. Please let me know if there is a way to store webview state
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…