2
How to change the application background when you click the square button (recent apps)?
I have already researched and some have indicated using the onPause
and onStart
to change the background using
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE);
Only when there’s going to be a screen change, he ends up setting the background. So I need to know if you have how to set this background only when you press the button that shows the recent app (square).
My goal is to hide the content of Activity when there is a change of application when pressing the home and reopen the application when pressing the square.
I changed the image for a smaller one not to pollute much the publication.
– Jéf Bueno
Thank you ! jbueno !
– Matheus Aguiar
You put the
setFlags
before thesetContentView
?– Guilherme Nascimento
In the end I ended up using this solution:
@Override
 public void onWindowFocusChanged(boolean hasFocus) {
 super.onWindowFocusChanged(hasFocus);
 if (!hasFocus) {}
only the problem is that it is called up when it has the transition from one screen to the other.– Matheus Aguiar
I think if there is the event of clicking on this button would already solve the problem ! Since using onPause, it did not work, because it is calling when there is the context change, when it changes from one Activity to another.
– Matheus Aguiar