What is the purpose of inputType textShortMessage
? How will this affect my application? Do certain keyboards, Android versions or applications treat this specially, or differently from just type text
?
The android:inputType attribute allows you to specify various behaviors for the input method. Most importantly, if your text field is intended for basic text input (such as for a text message), you should enable auto spelling correction with the "textAutoCorrect" value.
To get the input type use getInputType() . int inputTypeValue = editText. getInputType(); The InputType values are defined (in hexadecimal) in the documentation.
textPhonetic. Text that is for phonetic pronunciation, such as a phonetic name field in a contact entry. Corresponds to TYPE_CLASS_TEXT / TYPE_TEXT_VARIATION_PHONETIC . textWebEmailAddress. Text that will be used as an e-mail address on a web form.
Text that is a password that should be visible. Corresponds to. TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_VISIBLE_PASSWORD . textWebPassword.
Not that much difference between text
and textShortMessage
. While developing the Android Source, google developers felt to create two different class for two different cases. textShortMessage and textLongMessage both inherits the behaviour of text with some different attributes.
There could be so many types of input for a EditText. Android Developer made it easier for us to define the behaviour of a specific EditText.
textShortMessage is for: Variation of TYPE_CLASS_TEXT: entering a short, possibly informal message such as an instant message or a text message.
It means when we use textShortMessage as input type the EditText will open the alphabetic keyboard but the EditText will not be Expanded. If you change it to textLongMessage the EditText will be expanded for multiline text input.
SOURCE: http://developer.android.com/reference/android/text/InputType.html
One difference :
android:inputType="textShortMessage|textMultiLine"
Will give you the smiley button in preference to the enter key.
android:inputType="textMultiLine"
Will give you the "enter" key again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With