Example usage for android.widget TextView setText

List of usage examples for android.widget TextView setText

Introduction

In this page you can find the example usage for android.widget TextView setText.

Prototype

@android.view.RemotableViewMethod
public final void setText(@StringRes int resid) 

Source Link

Document

Sets the text to be displayed using a string resource identifier.

Usage

From source file:Main.java

public static void setText(View view, int resource, String text) {
    TextView textView = (TextView) view.findViewById(resource);
    textView.setText(text);
}

From source file:Main.java

private static TableRow generateAfiTblRow(Context context, String first, String second) {
    TableRow tr = new TableRow(context);
    tr.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

    LayoutParams childLp = new LayoutParams(0, LayoutParams.FILL_PARENT, 1);

    TextView amount = new TextView(context);
    amount.setText(first);
    amount.setGravity(Gravity.CENTER);//  w ww  .  j  a  va2  s.  c  o m
    tr.addView(amount, childLp);

    TextView score = new TextView(context);
    score.setText(second);
    score.setGravity(Gravity.CENTER);
    tr.addView(score, childLp);

    return tr;
}

From source file:Main.java

public static void setTitle(TextView title, Typeface font, String text) {
    title.setTypeface(font);
    title.setText(text);
}

From source file:Main.java

public static void setText(TextView textView, String text) {
    if (textView != null)
        textView.setText(text);
}

From source file:Main.java

public static void bindText(View view, Cursor cursor, int resource, String column) {
    TextView textView = (TextView) view.findViewById(resource);
    textView.setText(cursor.getString(cursor.getColumnIndex(column)));
}

From source file:Main.java

public static void setFormatedKey(String fingerprint, TextView field1, TextView field2) {
    int half = fingerprint.length() / 2;

    field1.setText(fingerprint.substring(0, half).replaceAll("(....)", "$1 "));
    field2.setText(fingerprint.substring(half).replaceAll("(....)", "$1 "));
}

From source file:Main.java

public static void setUnderlineStr(TextView tv, String str) {
    tv.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
    tv.setText(str);
}

From source file:Main.java

public static TextView createTextView(Context context, String text) {
    TextView tv = new TextView(context);
    tv.setPadding(10, 10, 10, 10);/*from ww  w  .  ja  v  a  2  s.  c om*/
    tv.setText(text);
    tv.setGravity(Gravity.CENTER);
    tv.setTextSize(24);
    tv.setTextColor(Color.RED);
    return tv;
}

From source file:Main.java

public static void addSpacer(Activity activity, LinearLayout layout, String sp, int size) {
    TextView mSpacer = new TextView(activity);
    mSpacer.setTextSize(size);/*from   w  ww. java2s .  c o m*/
    mSpacer.setText(sp);
    layout.addView(mSpacer);

}

From source file:Main.java

private static void addCount(Activity activity, Integer count, LinearLayout layout, String label) {
    if (count != null && count > 0) {
        TextView amt = new TextView(activity);
        amt.setTextSize(textSize);//from www  .j  av a2 s . co m
        amt.setText(count.toString() + " " + label + "  ");
        layout.addView(amt);
    }
}