Java tutorial
//package com.java2s; import android.text.TextUtils; import android.view.View; import android.widget.TextView; public class Main { public static void setupTextView(TextView tv, CharSequence chars) { if (TextUtils.isEmpty(chars)) { tv.setVisibility(View.GONE); } else { tv.setVisibility(View.VISIBLE); tv.setText(chars); } } }