Android EditText inputType textShortMessage - android

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?

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.

Related

android inputType="number" and "numberPassword" different keyboards, how to make same keyboards?

When in EditText xml layout I set android:inputType="number" I see one keyboard, with dash, dot and comma.
When I set android:inputType="numberPassword" I see another keyboard, only numbers this time.
How do I show keyboard with only numbers, without dot and comma, for a non-password EditText?
if you need only numbers then best option for you would be android:inputType="numberSigned"
and the keyboard... well, in fact keyboard style doesn't depend on you... this is another separated app installed in system and it try to fit inputType of EditText. some keyboard apps may have different buttons for inputType="number" and inputType="numberPassword", some other may have same UI, yet some other may just have one UI with all buttons for all inputTypes (thus some of these buttons may be inactive, e.g. letters when digit-only inputType)
even when your keyboard app provides different keyboard style doesn't mean that on another device with another keyboard app this behavior will be the same
you can join 2 types in inputType EditText in android
this link all type for EditText
for example you can use :
android:inputType="numberSigned|numberDecimal"
or
android:inputType="numberDecimal"

What difference between textMultiLine and textImeMultiLine in inputType EditText?

I am trying to understand the difference between the textMultiLine and
textImeMultiLine options for android:inputType in an EditText. However
I have not been able to understand an answer. The documentation
says
IME is a control enabling users to enter text.
but I don't understand how texMultiLine is different from textImeMultiLine.
TextImeMultiLine: Flag for TYPE_CLASS_TEXT: the regular text view associated with this should not be multi-line,
but when a fullscreen input method is providing text it should use multiple lines if it can.
TextMultiLine: Flag for TYPE_CLASS_TEXT: multiple lines of text can be entered into the field. If this flag is not set, the text field will be constrained to a single line. The IME may also choose not to display an enter key when this flag is not set, as there should be no need to create new lines.
What I was able discern in Googling it... TextImeMultiLine is for accepting text that is, "not directly represented on the keyboard," like from languages such as Chinese, Japanese, and Korean. Ime is input method editor.
An IME (input-method editor) is an application that allows a standard keyboard (such as a US-101 keyboard) to be used to type characters and symbols that are not directly represented on the keyboard itself.
https://www.w3.org/TR/ime-api/#IME

Is there a way to show numeric keypad of android but with only selected numbers?

Is there a way to show numeric keypad of android but with only selected numbers?
Like i want to only show the numbers 2,4,6,8..all other numbers and signs should be blocked.
is there a way to do that in android?
Not really. I believe that you have the following options:
Create a custom keyboard
The most important downside is that each of your users would have to select your keyboard from system settings as the default.
Create a view, which looks like a keyboard
Probably the best approach, but the 'keyboard' most likely won't look like the native one.
Handle only the desired keys and ignore other.
If you can show all buttons and handle only a few of them - do that.
From the docs, there is a XML Attribute that should do the trick, but I have not tested it:
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/yourEditTextId"
android:digits="2468"
android:inputType="number" />
The XML Attribute digits, which is inherited from TextView, is described as follows:
If set, specifies that this TextView has a numeric input method and that these specific characters are the ones that it will accept. If this is set, numeric is implied to be true. The default is false.

EditText - What is the difference between inputType="" and inputType="text"?

What is the difference between inputType="text" and not having the inputType field at all in an XML layout? The behavior does not appear to be different when I remove inputType completely (likely because I am just constantly updating uneditable text), but I'd just like to make sure.
This is in response to a strange ICS bug where if you have an EditText with any kind of inputType="__", a spellcheck is done and a red underline is placed on the misspelled word.
Thanks.
There is some difference interms of input richness. Here is a link Why Input type? and Inputtype interface API
In Inputtype interface link if you observe TYPE_CLASS_TEXT and TYPE_NULL you will clearly understand the difference.

How can you configure an EditText's soft keyboard to use numbers initially, but still allow text?

I want to let users input a postal code to my app. The common use case is the US zip code, which are composed solely of numbers, so I'd like to display the numeric keyboard initially in the soft input. However, not all postal codes are solely digits, so I still need users to be able to enter other characters.
I've been trying to do this with android:inputType, but by setting the "number" flag, it automatically blocks any input except for number-based stuff. Is there a way to just accept general text, but get the soft keyboard to initially display a more number-based keyboard?
Have you tried initially setting the inputType to "number" and then via a TextWatcher changing the input type of the TextView programatically?

Categories

Resources