Code example for InputMethodManager

Methods: hideSoftInputFromWindow

0
 
	// hide keyboard if showing 
	private void hideKeyboard() { 
		InputMethodManager imm = (InputMethodManager) ((Activity) getContext())
				.getSystemService(Context.INPUT_METHOD_SERVICE);
		imm.hideSoftInputFromWindow(getWindowToken(), 0);
	} 
 
	private void scrollRight() { 
		hideKeyboard(); 
		// unfocus login boxes 
		View selectedBox = findFocus();
		if (selectedBox != null)
			selectedBox.clearFocus();
		// scroll 
		int featureWidth = getMeasuredWidth();
		currentPage = (currentPage < (container.getChildCount() - 1)) ? currentPage + 1
				: container.getChildCount() - 1;
		smoothScrollTo(currentPage * featureWidth, 0);
 
	}