Java tutorial
//package com.java2s; import android.app.Activity; import android.widget.TextView; public class Main { public static void setTextInView(int viewId, String val, Activity activity) { TextView textView = (TextView) activity.findViewById(viewId); if (textView != null) textView.setText(val); } }