title: Android: Overlay on Window over Activities of a Task
body: <p>I wanted to create an Overlay, like a HUD, that resides on the screen during
  my applications activity stack (the task of my app) changes. </p>
  
  <p>I found a couple of examples using WindowManager but I couldn't figure out the parameterization for the correct z-index if you want. It was either to weak the next activity would go ontop of my overlay or to strong the overlay was a system wide overlay that was visible also when the app moved into the background.</p>
  
  <p>I aim for displaying a view on top of all activites belonging to my app or task (app would be preferred). I am aware that apps and tasks are two different things on android...</p>
  
  <p>What I explicitly don't want is to use system wide windows that require android.permission.SYSTEM_ALERT_WINDOW </p>
  
  <p>--- my usecase --</p>
  
  <p>I am implementing a flow that includes an activity providing a form for user input. that user input has to be processed in a rather complex manner, yielding a possible outcome of +/- 10 states. The processing can take up to 10 minutes and depending on the outcome of that process I want to display a corresponding view. While the process runs I intent to keep the user updated but can not allow him to navigate the app (except aborting the process). Every possible outcome of the long running operation will be presented in a different activity.</p>
  
  <p>I am well aware, that there are several approaches possible (for example having one activity only). But that decision has already been made and is out of scope of that question. I have implemented a solution that uses System Windows to display that overlay in. For hiding the overlay I have to count onStart, onStop events and interpret "App did to move into background" and "App did move into foreground". This feels dirty and I am not satisfied with that solution. I'd rather take a step back and display my overlay on top of the calling activity and upon finishing the process hiding it and moving forward to the activity displaying the result.</p>
  
  <p>One more thing I tried is to move a view from one activity to another. But this shows some flickering and interruption of my animation that I don't like.</p>
  
  <p>I would appreciate it if we could focus on the question of whether its possible to display a view on top of the application/task window rather than inside a system or activity window ;)</p>