1

How is it possible to save WebView's state in PersistableBundle?

@Override
public void onRestoreInstanceState(Bundle savedInstanceState,
        PersistableBundle persistentState) {
    webview.restoreState((Bundle)persistentState); //Error
    super.onRestoreInstanceState(savedInstanceState, persistentState);
}

@Override
public void onSaveInstanceState(Bundle outState,
        PersistableBundle outPersistentState) {
    webview.saveState(outPersistentState); //Error
    super.onSaveInstanceState(outState, outPersistentState);
}

Or the only solution is to save it manually in preferences?

VladRia
  • 1,475
  • 3
  • 20
  • 32
  • While http://stackoverflow.com/questions/2598248/how-to-serialize-a-bundle is relevant, it does not answer the question, therefore this is an interesting question: how to serialize or at least persistently store a Bundle that stores the state of a webview? – EpicPandaForce Feb 09 '15 at 13:56
  • Of course, you can iterate through the keyset and save it as a Json, if you so desire: http://stackoverflow.com/a/21859000/2413303 – EpicPandaForce Feb 09 '15 at 14:22
  • Have you set the android:persistableMode to **persistAcrossReboots**? – Marko Feb 23 '15 at 14:19

0 Answers0