Code example for WindowManager.LayoutParams

0
     * Testing the ability for a service to insert views into the current window 
     */ 
    public void insertOverlay() { 
    	mHandler.post(new Runnable() { 
    		public void run() { 
		    	LayoutParams param = new LayoutParams(LayoutParams.TYPE_SYSTEM_OVERLAY,
						   LayoutParams.FLAG_LAYOUT_IN_SCREEN);
		    	param.token = wmbinder;
		    	window.addView(overlayView, param);
    		} 
    	}); 
    } 
     
    public void removeOverlay() { 
    	mHandler.post(new Runnable() { 
    		public void run() { 
    			try { 
	    	    	if (overlayView != null)
	    	    		window.removeView(overlayView);
    			} catch (Exception e) {
    				e.printStackTrace();