Androidの SteamPy常见问题处理

1. 表情框,点击表情出现,内存泄漏

内存泄漏1_副本.jpg

将单例类GlobalOnItemClickManagerUtils ,传入Application context.

 GlobalOnItemClickManagerUtils globalOnItemClickManager = GlobalOnItemClickManagerUtils.getInstance(BaseApplication.get());
globalOnItemClickManager.attachToEditText(etContent);

2. 表情框,绑定输入框,内存泄漏

内存泄漏2_副本.jpg

绑定的输入框对象采用弱引用处理

public void attachToEditText(EditText editText) {
        mViewReference = new WeakReference<>(editText);
        if (mViewReference.get() != null) {
            mEditText = mViewReference.get();
        }
    }

你可能感兴趣的:(Androidの SteamPy常见问题处理)