I am dynamically creating an EditText
and I want to disable auto-capitalization on any sentences (new lines).
I have tried a variation of flags for EditText.setInputType(int)
but none of them have accomplished disabling the shift key being enabled on new lines.
Here is my code:
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
EditText editText = new EditText(context);
int type = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE
| InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE;
if (preferences.getBoolean("disable_suggestions", true)) {
type |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
| InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
}
if (preferences.getBoolean("disable_auto_capitalization", true)) {
//
// TODO: StackOverflow to the rescue! What flag do I need?
//
}
editText.setInputType(type);
I have searched StackOverflow extensively for an answer and the only question I found was this.