@Test public void testRequireViewByIdFound() { View view = getActivity().findViewById(R.id.view); assertSame(view, ActivityCompat.requireViewById(getActivity(), R.id.view)); }
@SuppressWarnings("TypeParameterUnusedInFormals") @NonNull public static <T extends View> T requireViewById(@NonNull Activity activity, @IdRes int id) { T view = activity.findViewById(id); if (view == null) { throw new IllegalArgumentException("ID does not reference a View inside this Activity"); } return view; }
ActivityCompat extends ContextCompat { @SuppressWarnings("TypeParameterUnusedInFormals") @NonNull public static <T extends View> T requireViewById(@NonNull Activity activity, @IdRes int id) { T view = activity.findViewById(id); if (view == null) { throw new IllegalArgumentException("ID does not reference a View inside this Activity"); } return view; } }
ActivityCompat extends ContextCompat { @SuppressWarnings("TypeParameterUnusedInFormals") @NonNull public static <T extends View> T requireViewById(@NonNull Activity activity, @IdRes int id) { T view = activity.findViewById(id); if (view == null) { throw new IllegalArgumentException("ID does not reference a View inside this Activity"); } return view; } protected  ActivityCompat(); }
ActivityCompat extends ContextCompat { @SuppressWarnings("TypeParameterUnusedInFormals") @NonNull public static <T extends View> T requireViewById(@NonNull Activity activity, @IdRes int id) { T view = activity.findViewById(id); if (view == null) { throw new IllegalArgumentException("ID does not reference a View inside this Activity"); } return view; } protected  ActivityCompat(); static void setPermissionCompatDelegate(
            @Nullable PermissionCompatDelegate delegate); @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) static PermissionCompatDelegate getPermissionCompatDelegate(); @Deprecated static boolean invalidateOptionsMenu(Activity activity); static void startActivityForResult(@NonNull Activity activity, @NonNull Intent intent,
            int requestCode, @Nullable Bundle options); static void startIntentSenderForResult(@NonNull Activity activity,
            @NonNull IntentSender intent, int requestCode, @Nullable Intent fillInIntent,
            int flagsMask, int flagsValues, int extraFlags, @Nullable Bundle options); static void finishAffinity(@NonNull Activity activity); static void finishAfterTransition(@NonNull Activity activity); @Nullable static Uri getReferrer(@NonNull Activity activity); @SuppressWarnings("TypeParameterUnusedInFormals") @NonNull static T requireViewById(@NonNull Activity activity, @IdRes int id); static void setEnterSharedElementCallback(@NonNull Activity activity,
            @Nullable SharedElementCallback callback); static void setExitSharedElementCallback(@NonNull Activity activity,
            @Nullable SharedElementCallback callback); static void postponeEnterTransition(@NonNull Activity activity); static void startPostponedEnterTransition(@NonNull Activity activity); static void requestPermissions(final @NonNull Activity activity,
            final @NonNull String[] permissions, final @IntRange(from = 0) int requestCode); static boolean shouldShowRequestPermissionRationale(@NonNull Activity activity,
            @NonNull String permission); @Nullable static DragAndDropPermissionsCompat requestDragAndDropPermissions(Activity activity,
            DragEvent dragEvent); }
ActivityCompat extends ContextCompat { @SuppressWarnings("TypeParameterUnusedInFormals") @NonNull public static <T extends View> T requireViewById(@NonNull Activity activity, @IdRes int id) { T view = activity.findViewById(id); if (view == null) { throw new IllegalArgumentException("ID does not reference a View inside this Activity"); } return view; } protected  ActivityCompat(); static void setPermissionCompatDelegate(
            @Nullable PermissionCompatDelegate delegate); @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) static PermissionCompatDelegate getPermissionCompatDelegate(); @Deprecated static boolean invalidateOptionsMenu(Activity activity); static void startActivityForResult(@NonNull Activity activity, @NonNull Intent intent,
            int requestCode, @Nullable Bundle options); static void startIntentSenderForResult(@NonNull Activity activity,
            @NonNull IntentSender intent, int requestCode, @Nullable Intent fillInIntent,
            int flagsMask, int flagsValues, int extraFlags, @Nullable Bundle options); static void finishAffinity(@NonNull Activity activity); static void finishAfterTransition(@NonNull Activity activity); @Nullable static Uri getReferrer(@NonNull Activity activity); @SuppressWarnings("TypeParameterUnusedInFormals") @NonNull static T requireViewById(@NonNull Activity activity, @IdRes int id); static void setEnterSharedElementCallback(@NonNull Activity activity,
            @Nullable SharedElementCallback callback); static void setExitSharedElementCallback(@NonNull Activity activity,
            @Nullable SharedElementCallback callback); static void postponeEnterTransition(@NonNull Activity activity); static void startPostponedEnterTransition(@NonNull Activity activity); static void requestPermissions(final @NonNull Activity activity,
            final @NonNull String[] permissions, final @IntRange(from = 0) int requestCode); static boolean shouldShowRequestPermissionRationale(@NonNull Activity activity,
            @NonNull String permission); @Nullable static DragAndDropPermissionsCompat requestDragAndDropPermissions(Activity activity,
            DragEvent dragEvent);  }