Java tutorial
//package com.java2s; import android.view.View; import android.widget.TextView; public class Main { public static boolean setText(View view, int resid, String text) { TextView mTextView = (TextView) view.findViewById(resid); if (mTextView != null) { mTextView.setText(text); return true; } return false; } }