title: Adding and deleting a keyboard without edittext in a fragment
body: <p>I'm creating a remote control that also let's people enter characters for a Minix android dongle. Via another app on a tablet or smartphone, people can enter data that is send to the dongle for input purposes.</p>
  
  <p>I'm trying to create a keyboard programmatically when i push on a button, with which I can get the keys that are entered in on the keyboard. I also have to delete the keyboard when i click on ANYTHING ELSE then the keyboard. This is the important part, since I'm using fragments and there are other views on the screen which, when pressed, also have to remove the keyboard.</p>
  
  <p>So how can i know when there is a touchinput on the phone/tablet that is not on the keyboard? I've tried the onfocusChanged, but this didn't work since my focus won't change if I press something on my screen.</p>
  
  <p>Currently I'm using this code, which allows me to show a keyboard when I press a button and intercept all the text that is entered on the keyboard.</p>
  
  <pre><code>mKeyboard = (Button) view.findViewById(R.id.buttonKeyboard);
  mKeyboard.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              final EditText plainTextInput = (EditText) view.findViewById(R.id.PlainTextInput);
              plainTextInput.requestFocus();
              InputMethodManager keyboard = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
  
              keyboard.showSoftInput(plainTextInput, 0);
              plainTextInput.addTextChangedListener(new TextWatcher() {
                  @Override
                  public void beforeTextChanged(CharSequence s, int start, int count, int after) {
  
                  }
  
                  @Override
                  public void onTextChanged(CharSequence s, int start, int before, int count) {
                      Log.e(TAG, s.toString());
                  }
  
                  @Override
                  public void afterTextChanged(Editable s) {
  
                  }
              });
              plainTextInput.getLayout();
          }
      });
  </code></pre>
  
  <p>Now how can I know when the user has pressed somewhere outside the keyboard, so I can close the keyboard? Or are there other ways of adding a keyboard without invisible edittexts?</p>