Android TextView Set setText(TextView tv, String str)

Here you can find the source of setText(TextView tv, String str)

Description

set Text

Declaration

public static void setText(TextView tv, String str) 

Method Source Code

//package com.java2s;

import android.widget.TextView;

public class Main {

    public static void setText(TextView tv, String str) {
        if (tv == null) {
            return;
        }/*ww  w  .  j  a va2  s  .  c o  m*/
        tv.setText(checkStr(str));
    }

    public static void setText(TextView tv, int str) {
        if (tv == null) {
            return;
        }
        tv.setText(str + "");
    }

    public static String checkStr(String str) {
        if (str != null && !str.equals("")) {
            return str;
        } else {
            return "";
        }
    }
}

Related

  1. setText(TextView tv, int str)
  2. setHtml(TextView view, String html)
  3. setHtml(Activity activity, View parent, int elementId, int resId)
  4. initDate(TextView view,int days)