set Text to TextView - Android android.widget

Android examples for android.widget:TextView

Description

set Text to TextView

Demo Code

import android.app.Activity;
import android.net.Uri;
import android.text.Html;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;

public class Main{

    public static void setText(TextView view, String text) {
        if (isEmpty(text)) {
            view.setVisibility(View.GONE);
            return;
        }//  w  ww .  ja va  2s  .co  m

        view.setText(text);
        view.setVisibility(View.VISIBLE);
    }

}

Related Tutorials