Android examples for User Interface:View Hide Show
Display a text or hide view if value is null or empty
//package com.java2s; import android.text.TextUtils; import android.view.View; import android.widget.TextView; public class Main { /**/*w w w .j ava 2 s . c o m*/ * Display a text or hide view if value is null or empty * * @param textView TextView which should be filled * @param text the value for the TextView */ public static void showTextOrHide(final TextView textView, final String text) { if (!TextUtils.isEmpty(text)) { textView.setText(text); } else { textView.setVisibility(View.GONE); } } }