Andrew
Andrew

Reputation: 14526

Restarting Android activity without redrawing webviews

I have an Android/HTML hybrid application that has a small number of nested ViewFlippers, RelativeLayouts and WebViews. The application doesn't need a keyboard, since it accepts no user input and the on-screen keyboard is never visible on the screen, but I've found that if I open or close a slide-out keyboard, the activity is restarted and the entire layout is rerendered, causing the webviews to get reloaded. And if I don't re-render these layout objects, the window eventually gets cleared (turns black).

I can't figure out how to suppress the keyboard event and I'm confused as to how to retain the layout objects (particularly the WebViews, which are time-consuming to fetch and render) so that they don't have to be rebuilt from scratch. Can anyone help me understand how retaining WebViews is accomplished?

Alternatively, is there a way to prevent the keyboard-open/close event from causing the activity to restart?

Upvotes: 0

Views: 103

Answers (1)

user658042
user658042

Reputation:

Try adding the android:configChanges="keyboardHidden" attribute to your activity in your AndroidManifest. That lets you handle the event that a keyboard gets hidden or available by yourself. Since you don't want to do anything on this event, it should be fine.

Further information

Upvotes: 1

Related Questions