CQM
CQM

Reputation: 44230

Android saveState of webview page

I noticed that in the browser app, when I scroll down a webpage and rotate the screen, the location of the webpage stays

But when I try this in a webview of my own, the webpage (and everything else in the activity) reloads. I know about onSaveInstanceState but that takes Bundles of primitate data types, what about location within a webview?

I need to be able to rotate the screen without changing anything

Insight appreciated

Upvotes: 0

Views: 812

Answers (1)

Pointer Null
Pointer Null

Reputation: 40380

Avoid Activity restarting when rotation happens:

In your manifest, add android:configChanges="orientation" in activity node, then your Activity won't be restarted during rotation, instead Activity.onConfigurationChanged will be called.

Then only onLayout will be called, and loaded data will remain in memory.

Upvotes: 2

Related Questions