3

I'm targeting SDK 15 and testing directly on my Galaxy Nexus running Android 4.0.2. I also have Auto-Capitalization turned on in my Android Keyboard Settings.

When I fist launch the application and load the following Activity in portrait mode and focus on the EditText, the textCapSentences is honored. If I leave this Activity, change my orientation to landscape, and relaunch the same activity and repeat the same steps -- the virtual keyboard starts out in all lowercase. If I remain in landscape, leave the Activity, and relaunch it, then the textCapSentences is honored and continues to be until I change the orientation again (at which time portrait mode would also not honor the textCapSentences the first time, but will honor it each subsequent time). In short, except for when the application first launches, it seems that an orientation change causes the textCapSentences to not be honored when the Activity has just been created. I'm not overriding onResume() and my onCreate() doesn't do anything fancy, it just sets the content view. Here is my Activity's layout/main.xml (I'm not using a layout-land/):

<?xml version="1.0" encoding="UTF-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true" >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >
        <EditText
            android:id="@+id/note"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="top"
            android:hint="Type note here"
            android:inputType="text|textMultiLine|textCapSentences"
            android:scrollHorizontally="false" />
    </LinearLayout>
</ScrollView>

Any advice would be much appreciated.

cbradley
  • 131
  • 2
  • 5
  • 4
    Input method editors (IMEs) do not have to honor all the settings in `android:inputType`. Those are suggestions or requests that you are making, not demands. That being said, what you're describing sounds like a bug in the IME. – CommonsWare Jan 27 '12 at 00:17
  • You could try setting input type via java code in the `onCreate`, or override `onResume` and do it there. You could consider using `android:configChanges="orientation"` on your activity in the manifest. It will stop the Activity from being destroyed and re-created. Could possibly help. – Reed Jan 27 '12 at 10:36
  • @CommonsWare Ah, I didn't know that about IMEs, thanks. And yes, I have a feeling it's a bug in the IME too. – cbradley Jan 30 '12 at 23:39
  • Thanks for `textMultiLine`. – CoolMind Mar 19 '19 at 12:09

0 Answers0