Created
August 25, 2014 13:54
-
-
Save swanson/acfaaac634314af7c405 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ViewHelper { | |
@SuppressWarnings("unchecked") | |
public static <ViewType extends View> ViewType findView(final Activity activity, int id) { | |
return (ViewType) activity.findViewById(id); | |
} | |
@SuppressWarnings("unchecked") | |
public static <ViewType extends View> ViewType findView(final Fragment fragment, int id) { | |
return (ViewType) fragment.getView().findViewById(id); | |
} | |
@SuppressWarnings("unchecked") | |
public static <ViewType extends View> ViewType findView(final View view, int id) { | |
return (ViewType) view.findViewById(id); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment