Code example for PopupWindow

Methods: dismissgetHeightgetWidth

0
			public boolean onTouch(View v, MotionEvent event) {
	            final int x = (int) event.getX();
	            final int y = (int) event.getY();
	             
	            if ((event.getAction() == MotionEvent.ACTION_DOWN)
	                    && ((x < 0) || (x >= mWindow.getWidth()) || (y < 0) || (y >= mWindow.getHeight()))) {
					aboutToDismiss(); 
	            } else if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
					aboutToDismiss(); 
					mWindow.dismiss();
					return true; 
				} 
				 
				return false; 
			} 
		}); 
 
		mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
	} 
	 
	protected abstract void aboutToDismiss();