pape pape - 1 year ago 66
Java Question

get the shor set by the user in the text view

I want to get the value which is enter 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?

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

Answer Source

You need to do something like this:

String value = ETadresseip1.getText().toString();
try {
   valeur = Short.parseShort(value);
} catch (NumberFormatException e){
   // Error
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download