如何$的onPause后的onDestroy()的对$ pvent()调用? [英] How to prevent call of onDestroy() after onPause()?

查看:301
本文介绍了如何$的onPause后的onDestroy()的对$ pvent()调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Andr​​oid应用程序,我已经注意到返回键上preSS,在onPause()自动,的onDestroy()获取调用后。

In my android application I have noticed that on press of back key, after onPause() automatically, onDestroy() is getting called.

我如何prevent从调用的onPause后的onDestroy()()?应用

How do I prevent the application from calling onDestroy() after onPause()?

我不想破坏返回键preSS后的实例。

I dont want to destroy the instances after back key press.

在返回键的preSS,我的WebView对象被破坏掉了。所以,我不能够再次访问web视图,一旦我preSS返回键。

On press of Back key, my webview object is getting destroyed. So, I am not able to access the webview again,once I press back key.

我有两个URL。想像一下URL1和URL2。

I have got two URLs. Imagine them as URL1 and URL2.

当我在web视图和preSS推出URL1返回键流量的onkeydown() - >的onPause()

When I launch URL1 in the webview and press back key the flow is onKeyDown() -> onPause()

当我在web视图和preSS推出URL2返回键流量的onkeydown() - >的onPause() - >的onDestroy()

When I launch URL2 in the webview and press back key the flow is onKeyDown() -> onPause() -> onDestroy()

为什么会出现在行为有区别吗?有它有什么做饼干?

Why is there a difference in the behaviour? Has it got anything to do with cookies?

有关的网址1 - cookies.isSecure = TRUE;

For URL1 -- cookies.isSecure=true;

有关URL2 - cookies.isSecure = FALSE;

For URL2 -- cookies.isSecure=false;

推荐答案

检查清单您的活动的声明。声明它在这样的最小化时,它可以存储数据的方式。

Check the declaration of your activity in Manifest. Declare it in such a manner that it can store the data when minimized.

活动应该恢复内容的能力。

Activity should have the capability to restore the content.

这篇关于如何$的onPause后的onDestroy()的对$ pvent()调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆