Android - Window Flags
Is there a way to detect when a window flag triggered? Let's just say I have a WindowManager.LayoutParams.FLAG_SECURE. How do I detect it when I triggered it? I tried googling the
Solution 1:
In your activity simply override onWindowAttributesChanged
, in Kotlin:
class MyActivity: AppCompatActivity() {
private var lastKnownWindowFlags = 0
override fun onWindowAttributesChanged(params: WindowManager.LayoutParams) {
if (params.flags != lastKnownWindowFlags) {
// New window flags!
lastKnownWindowFlags = params.flags
}
}
}
Post a Comment for "Android - Window Flags"