Skip to content

Instantly share code, notes, and snippets.

Avatar

Ahmed_Ghanayem Ahmed-Mostafa-Ghanayem

View GitHub Profile
View gist:acfaaac634314af7c405
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);
}
You can’t perform that action at this time.