如何prevent的活动被重新翻上屏幕关闭?
我做什么
我看到
在同一屏幕旋转屏幕关闭之前。
在的情况下我的应用程序(小事一桩,只是一个web应用程序有一个单一的web视图)的方案如下:
我做什么
我看到
web视图被重新加载页面。
我的期望
作为Bejewels情况下,我希望看到同样的画面,这对于我的应用程序是在previous状态的页面:脚本运行,一个表单域 填充等。
调试结果显示,我错了(在previous问题)和的onDestroy()和的onCreate()的画面时,刚满上被称为一个接一个。而且因为我仍然听到音乐,通过一个脚本,当屏幕关闭时,它看起来像的活性和web视图确实存在,直到我再次preSS电源按钮播放。
我试过了。
详情请看这里: Attach/detach Android的视图/从布局
How to prevent an activity from being recreated on turning screen off?
What I do
What I see
The same screen as before turning screen off.
In case of my application (trivial one, just a web-app with a single WebView) the scenario is the following:
What I do
What I see
The WebView is reloading the page.
What I expected
As in Bejewels case I want to see the same screen, that for my app is the page in its previous state: scripts are running, a form fields are filled etc.
Debugging showed, that I was wrong (in a previous question) and onDestroy() and onCreate() are being called one-by-one when the screen is just turned on. And since I still hear a music, played by a script, when the screen is off, it looks like both the activity and the WebView do exist until I press power button again.
What I tried.
解决方案
Details are here: Attach/detach Android view to/from layout
更多推荐
被重新翻上屏幕关闭prevent安卓活动
发布评论