Java tutorial
//package com.java2s; //License from project: GNU General Public License import android.app.Activity; import android.view.View; public class Main { public static <T> T findViewById(View v, int id) { return (T) v.findViewById(id); } public static <T> T findViewById(Activity activity, int id) { return (T) activity.findViewById(id); } }