title: How do I set multiple input types in an EditText on Android?
body: <p>I am trying to create an <code>EditText</code> with auto-capitalization and auto-correction implemented. I have manually figured out how to add <code>InputFilter</code>s to allow auto-capitalization, though this only works <em>after</em> the first letter is typed, and I have had no luck with auto correction (I tried to create an InputFilter that used <code>AutoText</code>, but I'm not sure how all that works). Ideally, I could just use EditText.setInputType(...) to handle everything, but so far this has not worked. Is there a way to achieve this? My failed attempt is shown below (I just get normal input).</p>
  
  <pre><code>EditText mEditText = new EditText(this);
  int inputType = InputType.TYPE_CLASS_TEXT;
  if (auto_capitalize) {
      inputType = mEditText.getInputType() | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS;
  }
  if (auto_correct) {
      inputType = mEditText.getInputType() | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT;
  }
  mEditText.setInputType(inputType);
  </code></pre>
  
  <p><strong>Please note, I am only interested in solutions for creating this <code>EditText</code> in code - not via XML.</strong></p>
  
  <p><strong>Edit</strong></p>
  
  <p>I found sound new documentation describing <a href="http://developer.android.com/reference/android/text/method/TextKeyListener.Capitalize.html">TextKeyListener</a>, however after trying to use this:</p>
  
  <pre><code>mEditText.setKeyListener(new TextKeyListener(TextKeyListener.Capitalize.CHARACTERS, true));
  </code></pre>
  
  <p>and using @farble1670's idea of using <code>setRawInputType</code>, so as not to affect the <code>KeyListener</code>s, there is still no change to the text.</p>