Create TextView and Set text to TextView - Android User Interface

Android examples for User Interface:TextView Value

Description

Create TextView and Set text to TextView

Demo Code


//package com.java2s;
import android.content.Context;
import android.util.TypedValue;

import android.widget.TextView;

public class Main {
    public static TextView text(Context context, String value, int spSize) {
        TextView textView = new TextView(context);
        textView.setText(value);// w  w  w .  j  a v  a2s .c  o m
        textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, spSize);
        return textView;
    }
}

Related Tutorials