Change application background in "recent apps"

Asked

Viewed 201 times

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.

This is the quoted button: inserir a descrição da imagem aqui

Similar to this example of this iOS app Parecido com esse exemplo desse aplicativo para iOS

  • I changed the image for a smaller one not to pollute much the publication.

  • Thank you ! jbueno !

  • You put the setFlags before the setContentView?

  • 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.

  • 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.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.