Android examples for User Interface:EditText
get Integer From EditText
//package com.java2s; import android.annotation.SuppressLint; import android.widget.EditText; public class Main { private static final Integer ZERO = 0; @SuppressLint("NewApi") public static Integer getIntegerFrom(EditText editText) { String stringValueFromEditText = getStringFrom(editText); return stringValueFromEditText.isEmpty() ? ZERO : Integer .valueOf(stringValueFromEditText); }/* w w w .j av a2s . c o m*/ public static String getStringFrom(EditText editText) { return editText.getText().toString(); } }