Android : get Integer value from EditText Android

on Friday, September 12, 2014


This is my activity.xml



<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/inputnumber"
android:inputType="number" />


this is mainactivity.java :



EditText num = (EditText) findViewById(R.Id.inputnumber) ;


the question is how can I get the integer value from this field as an integer and use it for example in a custom class I made like this to add 1 to the value of this input field?


my customclass.java



public static int addone(int a)
{
int b = a+1;
return b;
}

0 comments:

Post a Comment