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.
Asked
Active
Viewed 1.3k times
14
5 Answers
23
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!

japanjot singh
- 1,052
- 7
- 8
6
Set this way,
EditText input = (EditText).findViewById(R.id.ID);
input.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);

IntelliJ Amiya
- 74,896
- 15
- 165
- 198
2
Add these two attributes. It works.
android:capitalize="sentences"
android:inputType="textCapSentences"

Anitha Manikandan
- 1,160
- 7
- 19
-
5I tried it but it's not working. Also capitalized is depricated. – cool Boy Jul 29 '15 at 10:37
2
Set input type in XML as well as in JAVA file like this,
In XML,
android:inputType="textCapSentences"
and in JAVA file,
edittext.setRawInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
This worked for me and make sure your keyboard's Auto-Capitalization setting is Enabled.

Siddharth Sheth
- 207
- 2
- 6
0
On which devices and OS specific versions are you trying. Sometime the manufactures are overriding the "InputMethod
" on the OS level and it's just not working.
you can also make a test by taking the sources of the EditText
from google code and compile it as your EditTextCustom
and see if it's working.

danysz
- 580
- 3
- 11