Webview在Android中建立内存 [英] Webview building up the memory in 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屋!