Webview在Android中建立内存 [英] Webview building up the memory in Android

查看:219
本文介绍了Webview在Android中建立内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的混合Android应用程序中,在ListView项上单击,我通过传递WebView活动以及要显示的URL来加载WebView.用户可以通过单击后退"按钮返回到先前的视图.

In my hybrid Android application, on a ListView item click I'm loading a WebView by passing the WebView activity with the url to display in it. The user can come back to the earlier view by clicking back button.

但是发生的是单击3-4个ListView项目后,该应用程序运行缓慢,我认为这是因为WebView活动被一次又一次地加载而没有取消分配.

But what is happening is after clicking on 3-4 ListView items, the app is becoming slow, which I think is because WebView activity is loaded again and again without deallocating it.

推荐答案

在webview活动的onDestroy()中也销毁了WebView. myWebView.destroy();

In the onDestroy() of the webview activity destroy the WebView as well. myWebView.destroy();

这篇关于Webview在Android中建立内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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