Code example for WindowManager

Methods: addView, removeView

0
				mParams.verticalMargin = mVerticalMargin;
				mParams.horizontalMargin = mHorizontalMargin;
 
				if ( mView.getParent() != null ) {
					mView.setVisibility( View.GONE );
					mWm.removeView( mView );
				} 
 
				mWm.addView( mView, mParams );
				mView.setVisibility( View.VISIBLE );
 
				if ( mLayoutListener != null ) {
					mLayoutListener.onShown( mView );
				} 
			} 
		} 
 
		/** 
		 * Handle hide. 
		 */ 
		public void handleHide() { 
			removeView(); 
			if ( mLayoutListener != null ) {
				mLayoutListener.onHidden();
			} 
		} 
 
		/** 
		 * Removes the view. 
		 */ 
		void removeView() { 
			if ( mView != null ) {
				if ( mView.getParent() != null ) {
					mView.setVisibility( View.GONE );
					mWm.removeView( mView );
				} 
				mView = null;
			} 
		} 
	};