Code example for PopupWindow

Methods: dismiss

0
		pw.setFocusable(true);
		pw.setOutsideTouchable(true);
		pw.setTouchInterceptor(new OnTouchListener() {
			public boolean onTouch(View v, MotionEvent event) {
				if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
					pw.dismiss();
 
					return true; 
				} 
 
				return false; 
			} 
		}); 
 
		pw.setWidth(WindowManager.LayoutParams.WRAP_CONTENT);
		pw.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
		pw.setOutsideTouchable(false);
		pw.setContentView(popupView);
		pw.showAsDropDown(view, 0, 0);
 
Stop searching for code, let great code find you!  Add Codota to your java IDE