Android examples for User Interface:EditText
validate Required EditText
//package com.java2s; import android.widget.EditText; public class Main { public static boolean validateRequired(String requiredMessage, EditText... editTexts) {// w w w. j av a 2 s . c om boolean hasRequired = false; for (EditText editText : editTexts) { String textValue = editText.getText().toString(); if (textValue.trim().isEmpty()) { editText.setError(requiredMessage); hasRequired = true; } } return hasRequired; } }