Hi I have created a Custom Button Class by extending the Button class. I had overridden the onAttachedToWindow
and onDetachedFromWindow
methods. Now the problem is onDetachedFromWindow
never invoked. Below is the use case.
onDetachedFromWindow
not called. We should get callback when activity is no longer visible to the user. since activity lost it's window and no more attached to window.
Can anyone please help regarding this issue?
You want to override onWindowVisibilityChanged(int visibility)
. Mainly you'd be interested in visibility = VISIBLE
and visibility = GONE
.
您可以在活动中覆盖onPause()
并在其中进行操作。当您的活动不再对用户可见时,将调用此函数
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.