Code example for KeyEvent

Methods: getRepeatCount

0
		return false; 
	} 
	 
	private boolean handleMenuKeyDown(View v, KeyEvent event){
		InputMethodManager imm = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
		if(event.getRepeatCount() >= LONGPRESS_REPEATS){
			imm.showSoftInput(v, InputMethodManager.SHOW_FORCED);
			mCreatingSoftKeyboard = true;
			return true; 
		} 
		imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
		return false; 
	} 
	private boolean handleMenuKeyUp(View v, KeyEvent event){
		if(mCreatingSoftKeyboard){
			mCreatingSoftKeyboard = false;
			return true; 
		} 
		 
		return false; 
	}