pape pape - 4 months ago 6x
Java Question

Get the Short value set by the user in the text view

I want to get the value which is entered by the user in the

, but the value must be in a Short (not String). For an example, in this following case, if
was a short, how should I do it?

valeur = ETadresseip1.getText().toString();


You need to do something like this:

String value = ETadresseip1.getText().toString();
try {
   valeur = Short.parseShort(value);
} catch (NumberFormatException e){
   // Error