'Application Overlay using Night Mode

I am using an application overlay to draw over other apps as described here: https://www.geeksforgeeks.org/how-to-draw-over-other-apps-in-android/

The Problem is that always the 'Day' theme is used, even if I use AppCompatDelegate.setDefaultNightMode to set the default to 'Night'.

What am I missing? Can anyone help?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source