Android Question Are numbers only positive ?

derez

Expert
Licensed User
Longtime User
The "numbers" definition of the keyboard in Edittext does not alow input of negative numbers, although a minus key exists there. Is this correct, such attitude ?
 

DonManfred

Expert
Licensed User
Longtime User
B4X:
npTyp.Initialize
InpTyp.SetInputType(EditText1, Array As Int(InpTyp.TYPE_CLASS_TEXT, InpTyp.TYPE_TEXT_FLAG_CAP_CHARACTERS))  'uppercase letters

So based on https://stackoverflow.com/questions/25854495/use-android-number-keypad-but-allow-negative-numbers you should be able to adapt it to
B4X:
fromEditText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL
                    | InputType.TYPE_NUMBER_FLAG_SIGNED);
 
Upvote 0

derez

Expert
Licensed User
Longtime User
Thanks DonManfred, My question is exactly like the link you provided. The solution is even simpler - I use decimal numbers keyboard. I just wandered why it is so.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…