package com.bokecc.livemodule.utils;

import android.app.Activity;
import android.view.View;
import android.view.inputmethod.InputMethodManager;

public class KeyboardUtils {
 
    /**
     * 隐藏软键盘(只适用于activity，不适用于fragment)
     */
    public static void hideKeyboard(Activity activity) {
        View view = activity.getCurrentFocus();
        if (view != null) {
            InputMethodManager inputmethodmanager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
            inputmethodmanager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
        }
    }

}