[英]Android Webview - How to retain text data when orientation changes
I want to retain the text data in the webview (ie the data entered in the text box of the form in the url loaded) across the orientation changes. 我希望在方向更改中保留webview中的文本数据(即在加载的url中的表单的文本框中输入的数据)。 I used, onSaveInstanceState() * restoreState(savedInstanceState) it restores previous state but not the values.
我使用onSaveInstanceState() * restoreState(savedInstanceState)它恢复以前的状态而不是值。
I resorted to use webview with Fragments , still no luck in retaining the data. 我使用带有Fragments的webview ,仍然没有保留数据的运气。 Also when using Fragments the app crashes when orientation changes.
此外,当使用Fragments时,应用程序会在方向更改时崩溃。
I cannot use android:configChanges="keyboardHidden|orientation as I need keyboard when the orientation changes. 我不能使用android:configChanges =“keyboardHidden | orientation,因为当方向改变时我需要键盘。
Can anyone provide a solution to this ? 任何人都可以提供解决方案吗? Thanks in advance.
提前致谢。
Can't you use android:configChanges="orientation|screenSize"
without the keyboardHidden
? 你不能使用
android:configChanges="orientation|screenSize"
没有keyboardHidden
吗?
Edit : You may also want to use screenSize
when targeting API 13 or higher. 编辑 :您可能还希望在定位API 13或更高
screenSize
时使用screenSize
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.