You will have to parse it from the String
:
try
{
int actualValue = Integer.parseInt(text.getText());
System.out.println(actualValue);
}
catch (NumberFormatException e)
{
System.out.println("Not a number");
}
Be aware that this might throw a NumberFormatException
if the text cannot be cast to an integer.