Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

多进程应用使用会出现 Only the original thread that created a view hierarchy can touch its views #232

Open
chenqunming opened this issue May 16, 2023 · 1 comment

Comments

@chenqunming
Copy link

Caused by: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:11683)
at android.view.ViewRootImpl.invalidateChildInParent(ViewRootImpl.java:2620)
at android.view.ViewRootImpl.invalidateChild(ViewRootImpl.java:2615)
at android.view.View.setFlags(View.java:16769)
at android.view.View.setVisibility(View.java:12110)
at com.lzf.easyfloat.core.FloatingWindowHelper.setVisible(SourceFile:3)
at com.lzf.easyfloat.core.FloatingWindowManager.visible(SourceFile:1)
at com.lzf.easyfloat.core.FloatingWindowManager.visible$default(SourceFile:2)
at com.lzf.easyfloat.utils.LifecycleUtils.setVisible(SourceFile:1)
at com.lzf.easyfloat.utils.LifecycleUtils.checkShow(SourceFile:7)
at com.lzf.easyfloat.utils.LifecycleUtils.access$checkShow(SourceFile:1)
at com.lzf.easyfloat.utils.LifecycleUtils$setLifecycleCallbacks$1.onActivityResumed(SourceFile:3)
at android.app.Application.dispatchActivityResumed(Application.java:423)
at android.app.Activity.dispatchActivityResumed(Activity.java:1461)
at android.app.Activity.onResume(Activity.java:2034)

@chenqunming
Copy link
Author

        if (EasyFloat.isShow(EASY_FLOAT_TAG)) {
            EasyFloat.dismiss(EASY_FLOAT_TAG)
        }
        EasyFloat.with(MyApplication.instance)
            .setShowPattern(ShowPattern.ALL_TIME)
            .setLayout(R.layout.view_float_receive)
            // 设置吸附方式,共15种模式,详情参考SidePattern
            .setSidePattern(SidePattern.RESULT_TOP)
            // 设置浮窗的标签,用于区分多个浮窗
            .setTag(EASY_FLOAT_TAG)
            .setGravity(Gravity.CENTER_HORIZONTAL)
            // 设置浮窗是否可拖拽
            .setDragEnable(false)
            .registerCallback 

image

EasyFloat.with是Application,ShowPattern.ALL_TIME一直显示(不分前后台)
else Builder(LifecycleUtils.getTopActivity() ?: activity) mTopActivity有可能是之前页面被销毁activity,是不是会导致这个这问题?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant