Sundeep
Sundeep

Reputation: 405

Issue with android keypad popping up

I am developing an android application using fragments. I have a fragment that contains a list that holds some values. when I click on an item in the list view, it get redirected to another fragment. I have an Edit Text in that fragment. When I press on that edit text keypad pops up.

Now my issue is that when I go backs to the previous fragment with out minimizing the keypad, the keyboards stats in the previous fragment also.

How can I remove the keypad when I moves back to the first screen?

Upvotes: 0

Views: 70

Answers (1)

M D
M D

Reputation: 47817

You force fully hide Key Board in Fragment like

   InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);                     
   imm.hideSoftInputFromWindow(getView().getWindowToken(), 0);

Upvotes: 1

Related Questions