Skip to content

Instantly share code, notes, and snippets.

@objcode
Last active January 28, 2020 19:37
Show Gist options
  • Save objcode/8f555c8c007634565ff513f2e7693e21 to your computer and use it in GitHub Desktop.
Save objcode/8f555c8c007634565ff513f2e7693e21 to your computer and use it in GitHub Desktop.
@NonNull
public static ActivityAwesomeBinding bind(@NonNull View rootView) {
/* Edit: Simplified code – the real generated code is an optimized version */
Button button = rootView.findViewById(R.id.button);
TextView subtext = rootView.findViewById(R.id.subtext);
TextView title = rootView.findViewById(R.id.title);
if (button != null && subtext != null && title != null) {
return new ActivityAwesomeBinding((ConstraintLayout) rootView, button, subtext, title);
}
throw new NullPointerException("Missing required view […]");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment