Java tutorial
//package com.java2s; import android.app.Activity; import android.widget.TextView; public class Main { public static TextView setText(Activity activity, int resourceId, String text) { TextView tv = (TextView) activity.findViewById(resourceId); if (text != null) { tv.setText(text); } return tv; } }