0

Firstly, is there is a way to access the scroll bar state and reuse that?

Secondly, this might not work on rotate, however, as the switch between portrait and landscape would render the html differently. (Perhaps this is acceptable?) Since the html is local app-generated chunks of data (in this case a list of quotes) I could possibly inject anchor tags into the html if I can determine which chunk is top of focus. Or perhaps there is a way to get the current top line of text (assuming no duplicates) and magically translate that to a scroll bar position. Pros and cons?

I guess I'd like to do a little better than just re-launch the webview html at the top of the page.

Harry HB
  • 77
  • 3
  • 6

1 Answers1

1

please see below links:

Webview saving state of page

http://twigstechtips.blogspot.in/2013/08/android-retain-instance-of-webview.html

Community
  • 1
  • 1
MohdTausif
  • 498
  • 4
  • 13
  • Good post. I got halfway through making the changes recommended and the problem went away. I think it was adding android:configChanges="keyboard|keyboardHidden|orientation|screenSize" that did it. ...and I'm not even saving/restoring the WebView. Now when I rotate the device the updated display does a best guess of where we were at scroll/content-wise and gets it right to within a line. Pretty impressive. – Harry HB Apr 22 '14 at 15:00