Java tutorial
//package com.java2s; /* * The MIT License (MIT) * Copyright (c) 2014 longkai * The software shall be used for good, not evil. */ import android.text.TextUtils; import android.widget.EditText; public class Main { public static boolean hasLength(EditText editText) { // text never null! String str = editText.getText().toString(); if (!TextUtils.isEmpty(str)) { return str.trim().length() > 0; } else { return false; } } }