Skip to content

Instantly share code, notes, and snippets.

View Ahmed-Mostafa-Ghanayem's full-sized avatar

Ahmed Mostafa Ahmed-Mostafa-Ghanayem

View GitHub Profile
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);
}