set View Text - Android User Interface

Android examples for User Interface:TextView Value

Description

set View Text

Demo Code


//package com.java2s;
import android.app.Activity;

import android.view.View;
import android.widget.TextView;

public class Main {
    public static void setText(Activity activity, int textViewId,
            String text) {/*from  w  ww. j  a  va 2  s  . c  o  m*/
        ((TextView) activity.findViewById(textViewId)).setText(text);
    }

    public static void setText(View itemView, int textViewId, String text) {
        ((TextView) itemView.findViewById(textViewId)).setText(text);
    }
}

Related Tutorials