I am attempting to add a DrawerListener to my Draw...
# android
k
I am attempting to add a DrawerListener to my DrawerLayout in Activity onCreate:
binding.quickviewDrawer.addDrawerListener(listener)
but the listener seems to be getting nulled out when I add a breakpoint in DrawerLayout.java Anyone have an idea why my listener is not persisting?
This is my listener that is in the LoginActivity class
Copy code
val listener =  object: DrawerLayout.SimpleDrawerListener() {
    override fun onDrawerOpened(drawerView: View) {
        super.onDrawerOpened(drawerView)
        Toast.makeText(this@LoginActivity, "DrawerOpened!", Toast.LENGTH_SHORT).show()
    }
}
The error was not in fact Kotlin related at all! I had layout_gravity="right" on a nested DrawerLayout in XML rather than my FrameLayout.