All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dwivedi.androidformvalidation.validator.FormUtils Maven / Gradle / Ivy

package com.dwivedi.androidformvalidation.validator;

import android.content.Context;
import android.view.inputmethod.InputMethodManager;
import android.widget.TextView;

/**
 * 
 * @author Created by Ashish Dwivedi (see
 *         https://github.com/dwivedi/AndroidFormValidation-TheRightWay).
 *         Modified and incorporated to ioc-commons-android-impl by Jesús Lunar
 *         Pérez
 */
public class FormUtils {

	public static void showKeyboard(Context context, TextView textView) {
		InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);

		if (imm != null) {
			// only will trigger it if no physical keyboard is open
			imm.showSoftInput(textView, 0);
		}
	}

	public static void hideKeyboard(Context context, TextView textView) {
		InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);

		if (imm != null) {
			// only will trigger it if no physical keyboard is open
			imm.hideSoftInputFromWindow(textView.getWindowToken(), 0);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy