title: Closing Soft Keyboard in Fragment
body: <p>I found a number of answers to this question but none of them are working for me. I have an Edit text in my Fragment, which gets launched when the application starts. When this Fragment opens, the soft keyboard pops up as well. How do I prevent that from happening? This is what I have in my onCreateView method in my Fragment....</p>
  
  <pre><code>        try {
          InputMethodManager imm = (InputMethodManager)getActivity().getSystemService(
                  Context.INPUT_METHOD_SERVICE);
          imm.hideSoftInputFromWindow(userName.getWindowToken(), 0);
      }catch(Exception e) {
          e.printStackTrace();
      }
  </code></pre>