is TextView Empty - Android User Interface

Android examples for User Interface:TextView

Description

is TextView Empty

Demo Code


//package com.java2s;

import android.text.TextUtils;

import android.widget.TextView;

public class Main {

    public static boolean isTextViewEmpty(TextView tv) {
        if (tv == null) {
            throw new NullPointerException("TextView can not be null.");
        }/*from   w  w  w  .ja  v a  2 s  .  co  m*/
        if (tv.getText() != null
                && TextUtils.isEmpty(tv.getText().toString())) {
            return true;
        }

        return false;
    }
}

Related Tutorials