AndroidUtilCode 在Activity中使用ToastUtils后finish当前activity,控制台会提示内存泄漏,用原生Toast.maketext就不会是咋回事呢?

nwnhqdif  于 6个月前  发布在  Android
关注(0)|答案(4)|浏览(69)

打印的泄漏日志:
android.view.WindowLeaked: Activity com.bank.account.BuyActivity has leaked window android.widget.ImageView{b3912b1 V.ED..... ......ID 0,0-296,146} that was originally added here
at android.view.ViewRootImpl.(ViewRootImpl.java:1038)
at android.view.ViewRootImpl.(ViewRootImpl.java:1022)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:401)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:154)
at com.blankj.utilcode.util.ToastUtils$WindowManagerToast.show(ToastUtils.java:630)
at com.blankj.utilcode.util.ToastUtils$ActivityToast.showWithActivityWindow(ToastUtils.java:739)
at com.blankj.utilcode.util.ToastUtils$ActivityToast.show(ToastUtils.java:680)
at com.blankj.utilcode.util.ToastUtils$2.run(ToastUtils.java:494)
at com.blankj.utilcode.util.ThreadUtils.runOnUiThread(ThreadUtils.java:70)
at com.blankj.utilcode.util.UtilsBridge.runOnUiThread(UtilsBridge.java:554)
at com.blankj.utilcode.util.ToastUtils.show(ToastUtils.java:483)
at com.blankj.utilcode.util.ToastUtils.show(ToastUtils.java:472)
at com.blankj.utilcode.util.ToastUtils.showShort(ToastUtils.java:412)

t1qtbnec

t1qtbnec1#

一样的问题,有内存泄漏

hwamh0ep

hwamh0ep2#

一样的问题,有内存泄漏问题

e0uiprwp

e0uiprwp4#

在页面销毁的时候调用ToastUtils.cancel();
但是会取消吐司

相关问题