Java tutorial
//package com.java2s; import android.widget.EditText; public class Main { public static int getInt(EditText et) { String string = getString(et); if (string == null || string.length() == 0) { return 0; } return Integer.valueOf(getString(et)); } public static String getString(EditText et) { return et.getText().toString().trim(); } }