Android examples for User Interface:EditText
get Float from EditText
import android.util.Log; import android.widget.EditText; public class Main { public static float getFloat(String intString) { try {// w w w . ja va 2s . c om return Float.parseFloat(intString); } catch (NumberFormatException e) { Log.wtf("FloatingButtons", e.toString()); return 0; } } public static float getFloat(EditText view) { return getFloat(view.getText().toString()); } }