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