title: How to create always-top fullscreen overlay activity in Android
body: <p>I'd like to be able to create an Activity that is always at the front of display of Android.
  It should receive no input, just pass it down to whatever application is next below it. Something like a HUD.</p>
  
  <p>I was able to research that I need to set underlying window type to TYPE_SYSTEM_ALERT but it looks like Android is ignoring my code - no exception thrown even if I delete android.permission.SYSTEM_ALERT_WINDOW permission from manifest. (it is required to use this window type). When I tried to use ALERT type on dialog, it worked OK, but I cannot make dialog into full screen transparent entity.
  Here is my code, maybe there is something simple missing.</p>
  
  <pre><code>public void onCreate(Bundle savedInstanceState) {       
       super.onCreate(savedInstanceState);        
  
       requestWindowFeature(Window.FEATURE_NO_TITLE);
       getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
       getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);             
       getWindow().setBackgroundDrawableResource(android.R.color.transparent);
       getWindow().setFormat(PixelFormat.TRANSLUCENT);
       setContentView(R.layout.main);
  }
  </code></pre>
  
  <p>Translucent setting has to be enabled externally in xml manifest, otherwise it also didn't work.</p>
  
  <pre><code> &lt;item name="android:windowIsTranslucent"&gt;true&lt;/item&gt;
  </code></pre>