Skip to content

Instantly share code, notes, and snippets.

@dlew
Created July 12, 2012 19:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dlew/3100299 to your computer and use it in GitHub Desktop.
Save dlew/3100299 to your computer and use it in GitHub Desktop.
Easier findVewById()
@SuppressWarnings("unchecked")
public static <T extends View> T findView(Activity activity, int id) {
return (T) activity.findViewById(id);
}
@SuppressWarnings("unchecked")
public static <T extends View> T findView(View view, int id) {
return (T) view.findViewById(id);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment