handleWindowVisibility: no activity for token android.os.BinderProxy

In some cases, I've found that using onCreate with a persistentState parameter can cause the issue:

    override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
        super.onCreate(savedInstanceState, persistentState)
    }

Changing the onCreate to only use the savedInstanceState parameter fixes the issue:

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
    }

This code Seems correct but my only suspicion is that when you want to open the new activity in startActivity(intent), the error occurs.
So check the next fired class named SelfieCapture.class to see whether it extends from MyBaseActivity also.
Also consider that when you want to get the currentActivity, if you put it in onCreate, you will get null. For more information please refer to Understand the Activity Lifecycle.

Tags:

Android