At times you want to control what kind of data a user can put in an edittext field.
If a user inadvertently adds a letter to a field that is supposed to do calculations, this might cause your app to crash. A good way to avoid this is by using the input type filter.
This tutorial will take you through the various input type options and what they do.
Where to find the input type option
On your Sketchware project screen add an edittext to your project. Click on this edittext as shown below to open the properties menu.
To locate the input type menu, simply scroll to that option as shown below.
The input type property in Sketchware currently has six six options. These are text, number signed, number decimal, number signed number decimal, phone and password.
Each of these causes your keyboard or edittext field to behave a certain way.
text
This option will allow you to enter text characters which include letters, numbers, symbols and even emojis. When you choose this option your keyboard will look as shown below.
numberSigned
This option only allows you to enter only numerical values and a negative(minus) sign. These are particularly helpful in scenarios whereby users are entering data repetitively...
numberDecimal
This is similar to number signed but the difference is that it comes with a decimal comma instead of a minus sign. Thus the keyboard will look as shown below if this option is chosen.
numberSigned|numberDecimal
This is a combination of the previous two... number signed and number decimal. It comes with both a decimal comma and a negative sign.
Phone
This option enables you to enter data that would work when using your phone or ussd. This is a limited combination of numbers, letters and a few symbols. The keyboard will look similar to the one below.
textPassword
This option does not change the keyboard but it hides the contents of the edittext field. This is useful when creating a password field whereby the user can enter their details without worrying what the person beside them will see. When this is enabled it makes your edittext look similar to the one below whenever data is entered.
Using the above options you can determine how users enter data in your app.
I hope you found this helpful and you will use this in your app.
Comments