Search code examples
androidandroid-edittextcapitalization

Setting Sentence Capitalization on EditText Programmatically


Without using XML, how do I set EditText to capitalize sentences and still have predictive text working? I tried EditText.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES) and that works but it disables predictive text. How do I get predictive text and sentence capitalization both on, without using XML.


Solution

  • Nevermind, found it! EditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);