Answers for "hide keyboard android compose"

4

android hide keyboard

public void hideKeyboard(Context context, View view) {
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}

// call from inside an Activity...
hideKeyboard(this, view);
hideKeyboard(this, getCurrentFocus());
hideKeyboard(this, getWindow().getDecorView());
hideKeyboard(this, findViewById(android.R.id.content));
Posted by: Guest on February-11-2021
0

hide keyboard android

// This is use in Acitivity

InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);

//This is use in Fragement
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getView().getWindowToken(), 0);


Source:  StakeOverFlow
Posted by: Guest on October-06-2021

Code answers related to "hide keyboard android compose"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language