title: How to add an activity to WindowManager
body: <p>I am writing an android library that needs to display an activity on top of the client app. After some reading up it seems that adding a new window is what I want to do so I added in this permission.</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/&gt;
  </code></pre>
  
  <p>I then try to add an image view by doing this</p>
  
  <pre><code>        windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
  
          WindowManager.LayoutParams params = new WindowManager.LayoutParams(
                  WindowManager.LayoutParams.WRAP_CONTENT,
                  WindowManager.LayoutParams.WRAP_CONTENT,
                  WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
                  WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
                  PixelFormat.TRANSLUCENT);
  
          params.gravity = Gravity.BOTTOM | Gravity.LEFT;
          params.x = 10;
          params.y = 100;
  
          ImageView imageview = new ImageView(this);
  
          imageview.setImageResource(R.drawable.avatar);
          windowManager.addView( imageview , params);
  </code></pre>
  
  <p>But what I want is to have my own activity on this new window on top of the client apps window. is this even possible? How would I do this?</p>