package com.lateensoft.pathfinder.toolkit.util;
import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
/**
* @author tsiemens
*/
public class InputMethodUtils {
public static void hideSoftKeyboard(Activity activity) {
InputMethodManager inputMethodManager = (InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE);
View focus = activity.getCurrentFocus();
if (focus != null && inputMethodManager!= null) {
inputMethodManager.hideSoftInputFromWindow(focus.getWindowToken(), 0);
}
}
public static void showSoftKeyboard(Activity activity){
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
if (inputMethodManager != null) {
inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
}
}