set Text Or Hide TextView - Android User Interface

Android examples for User Interface:TextView

Description

set Text Or Hide TextView

Demo Code


import android.view.View;
import android.widget.TextView;

public class Main{
    public static void setTextOrHide(TextView pView, CharSequence pText) {
        if (StringHelper.isEmpty(pText)) {
            pView.setVisibility(View.GONE);
        } else {//from   w w w . j a  v a 2 s  . c  o m
            pView.setText(pText);
            pView.setVisibility(View.VISIBLE);
        }
    }
}

Related Tutorials