create TextView and set text - Android User Interface

Android examples for User Interface:TextView Value

Description

create TextView and set text

Demo Code


//package com.java2s;

import android.content.Context;

import android.widget.TextView;

public class Main {
    public static TextView createTextView(Context context, String label) {
        TextView textview = new TextView(context);
        textview.setText(label);//  w  w  w. ja v a  2  s  .  c om
        return textview;
    }

    public static TextView createTextView(Context context, String label,
            int padding_left) {
        TextView textview = new TextView(context);
        textview.setText(label);
        textview.setPadding(padding_left, 0, 0, 0);
        return textview;
    }
}

Related Tutorials