set Number to TextView - Android android.widget

Android examples for android.widget:TextView

Description

set Number 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 setNumber(TextView view, Integer num) {
        view.setVisibility(View.GONE);

        if (num != null && num > 0) {
            view.setText(Integer.toString(num));
            view.setVisibility(View.VISIBLE);
        }//from   w  w  w.  ja v  a2s . c o m
    }

}

Related Tutorials