久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Android EditText 內(nèi)存泄漏

Android EditText Memory Leak(Android EditText 內(nèi)存泄漏)
本文介紹了Android EditText 內(nèi)存泄漏的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

限時(shí)送ChatGPT賬號(hào)..

很多人注意到活動(dòng)中的 EditText 持有對(duì)活動(dòng)的強(qiáng)引用,即使它完成后也是如此.要清楚,此 EditText 位于布局內(nèi)并膨脹,沒(méi)有設(shè)置 Listeners.這只發(fā)生在某些設(shè)備上,例如三星 Galaxy S4 (Android 4.2.2) 等.許多關(guān)于此的帖子仍然沒(méi)有解決方案.首先是一些有用的帖子.(最終 GC 會(huì)清除它,因此從技術(shù)上講它不是泄漏,但對(duì)于內(nèi)存大的應(yīng)用程序來(lái)說(shuō),它需要很長(zhǎng)時(shí)間并且會(huì)導(dǎo)致 OOM)

Alot of people are noticing EditText in an activity is holding a Strong Reference to an Activity even once its finished. To be clear this EditText is inside a layout and inflated, there is no Listeners set. This only happens on certain devices e.g. Samsung Galaxy S4 (Android 4.2.2) and others. Many post about this still no solution. First here is some useful posts. (Eventually GC will clean this so its not technically a leak, but for heavy memory apps it takes way to long and will cause OOM)

Android Samsung Memory leak in EditText

Why does EditText retain its Activity's Context in Ice Cream Sandwich

EditText causing memory leak

Possibility of unhandled memory leak

The solutions noted do not work for all devices. It comes down to the Edittext Watcher. I think there may be solution in overriding this Watcher then having a function to clean it up onDestroy(). Please any help here, I been at this for days.

Here is the MAT Histogram

解決方案

It is because EditText references the context of Activity. When the Activity is destroyed, Activity cannot be recycled normally because Edittext holds a reference to the context of activity. Solution: Rewrite EditText, change the reference to the Context in Activity to the reference to ApplicationContext.

Instructions:

https://programming.vip/docs/solve-the-memory-leak-problem-caused-by-edittext-in-android.html

這篇關(guān)于Android EditText 內(nèi)存泄漏的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Cut, copy, paste in android(在android中剪切、復(fù)制、粘貼)
android EditText blends into background(android EditText 融入背景)
Change Line Color of EditText - Android(更改 EditText 的線條顏色 - Android)
EditText showing numbers with 2 decimals at all times(EditText 始終顯示帶 2 位小數(shù)的數(shù)字)
Changing where cursor starts in an expanded EditText(更改光標(biāo)在展開的 EditText 中的開始位置)
EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView問(wèn)題)
主站蜘蛛池模板: 免费三级网 | 日韩在线免费视频 | 亚洲嫩草| 伊人二区| 亚洲一区 中文字幕 | 国产黄a一级| 久久久夜夜夜 | 九色在线观看 | 综合久 | av电影一区 | 特黄av| 中文在线一区 | 久草在线| 国产亚洲精品美女久久久久久久久久 | 手机三级电影 | 99久久国产免费 | 剑来高清在线观看 | 欧美精品久久久久 | 奇米四色影视 | 日韩免费av网站 | 亚洲激情在线观看 | 国产一区二区三区免费观看在线 | 国产成人在线一区二区 | 黄色网址在线免费观看 | 欧美精品在线一区 | 日韩中文字幕一区二区 | 亚洲在线一区二区三区 | 国产精品久久久久影院色老大 | 免费观看一级特黄欧美大片 | 91精品国产综合久久久久久 | 99色综合| 狠狠干狠狠操 | 亚洲成人av一区二区 | 国产精品久久久久久久久久妇女 | 夜夜草| 蜜月va乱码一区二区三区 | 久久精品亚洲 | 国产一区二区三区四区hd | 亚洲精品自在在线观看 | 国产资源在线视频 | 久久国产一区二区三区 |