title: Android overlapping views when using WindowManager
body: <p>I'm using WindowManager to add views to the users screen using an IntentService, as shown here:</p>
  
  <pre><code>WindowManager.LayoutParams params = new WindowManager.LayoutParams(
              WindowManager.LayoutParams.WRAP_CONTENT,
              WindowManager.LayoutParams.WRAP_CONTENT,
              WindowManager.LayoutParams.TYPE_PHONE,
              WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
              PixelFormat.TRANSLUCENT);
  
      params.gravity = Gravity.BOTTOM | Gravity.CENTER;
      params.x = 0;
      params.y = 100;
      windowManager.addView(cardView, params);
  </code></pre>
  
  <p>When I first launch the IntentService, the view is created as expected. However, when I re-launch the IntentService, a new view is added but the previous view remains. </p>
  
  <p>How can I remove all the views that I have already added before adding a new view? I know that if I kill the IntentService then the views disappear, but how do I delete all other instances of my IntentService except the instance that I have just launched?</p>
  
  <p><em>This is what it looks like when I first call the IntentService:</em>
  <img src="https://i.stack.imgur.com/t2lBa.jpg" alt="2]"></p>
  
  <p><em>By the time the IntentService has been called multiple times, a shadow appears because there are so many view stacked on top of each other:</em>
  <img src="https://i.stack.imgur.com/BKWzz.jpg" alt="1]"></p>