Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EditText input type textCapSentences not working on Lollipop

I have implemeted android:inputType="textAutoComplete|textCapSentences" in my xml code. When I run it on kitkat, textCapSentence works fine but when build is run on Lollipop device it does not work. Anybody knows how to solve it.

like image 910
cool Boy Avatar asked Jul 29 '15 10:07

cool Boy


People also ask

How to Set input type in EditText android?

To get the input type use getInputType() . int inputTypeValue = editText. getInputType(); The InputType values are defined (in hexadecimal) in the documentation.

What is textCapSentences?

textCapSentences. Can be combined with text and its variations to request capitalization of the first character of every sentence. Corresponds to TYPE_TEXT_FLAG_CAP_SENTENCES .


2 Answers

Hi this is because in lollipop if you have disabled Auto - Capitalization in keyboard settings then you can't enable it programmatically.

here are the steps:-

  • Tap icon of ‘Settings’ on the Home screen of your Android Lollipop Device
  • At the ‘Settings’ screen, scroll down to the PERSONAL section and tap the ‘Language & input’ section.
  • At the ‘Language & input’ section, select your keyboard(which is marked as current keyboard).
  • Now tap the ‘Preferences’.
  • Tap to check the ‘Auto – Capitalization’ to enable it.
  • That’s all!
like image 146
japanjot singh Avatar answered Oct 19 '22 17:10

japanjot singh


Set this way,

EditText input = (EditText).findViewById(R.id.ID);
input.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
like image 42
IntelliJ Amiya Avatar answered Oct 19 '22 18:10

IntelliJ Amiya