title: How do I close the keyboard when the navigation drawer opens?
body: <p>I have added a navigation drawer to my application. So far everything else works well but I am having an issue where when the navigation drawer opens the keyboard is not closed. The navigation drawer is the main activity and then each page opened from the drawer is a fragment.</p>
  
  <p>I have tried adding the following to each one of my EditText areas in the fragments. However, this is not closing anything.</p>
  
  <pre><code>InputMethodManager imm1 = (InputMethodManager)getActivity().getSystemService(
              Context.INPUT_METHOD_SERVICE);
          imm1.hideSoftInputFromWindow(input1.getWindowToken(), 0);
  </code></pre>
  
  <p>I have also tried placing that code in the main activity but have been unsuccessful there as well. Any ideas on what I can do differently to get this working?</p>