Skip to content

Instantly share code, notes, and snippets.

@LeastFixedPoint
Created June 13, 2012 19:58
Show Gist options
  • Save LeastFixedPoint/2926103 to your computer and use it in GitHub Desktop.
Save LeastFixedPoint/2926103 to your computer and use it in GitHub Desktop.
public class FindView {
public static In in(final View view) {
return new In() {
@Override
@SuppressWarnings("unchecked")
public View byId(final int id) {
return view.findViewById(id);
}
};
}
public static In in(final Activity activity) {
return new In() {
@Override
@SuppressWarnings("unchecked")
public View byId(final int id) {
return activity.findViewById(id);
}
};
}
public interface In {
<T extends View> T byId(int id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment