Android examples for User Interface:TextView Value
Set TextView Text And Visibility
//package com.java2s; import android.view.View; import android.widget.TextView; public class Main { public static void SetTextAndVisibility(TextView view, CharSequence text) { SetTextAndVisibility(view, text, View.GONE); }//from w w w . j a v a 2 s. c om public static void SetTextAndVisibility(TextView view, CharSequence text, int visibilityIfEmpty) { if (text == null || text.length() == 0) { view.setVisibility(visibilityIfEmpty); } else { view.setVisibility(View.VISIBLE); view.setText(text); } } }