Android: how can I change the Context (specifically light/dark mode) temporarily for a local routine

Viewed 12

In an app I have a routine that creates a chart (and a bitmap for that chart) and it uses getResources() of the current context to get the current colors, according to light or dark mode.

Now it happens this routine is being "called" from a different application on a different phone (using remote calls by the Firebase Realtime Engine) and the other phone might have a different settings of the ligh/dark mode, causing a chart that is of the wrong style (the local one). Of course I can pass the mode of the other phone, but how can I switch in that routine (temporarily, just for this routine!) the context's settings?

0 Answers
Related