Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

ContentView

@Target([AnnotationTarget.CONSTRUCTOR]) class ContentView
androidx.annotation.ContentView

Annotation that can be attached to a constructor with a single LayoutRes parameter to denote what layout the component intends to inflate and set as its content.

It is strongly recommended that components that support this annotation specifically call it out in their documentation.

 public class MainFragment extends Fragment { public MainFragment() { // This constructor is annotated with @ContentView super(R.layout.main); } } 
see androidx.activity.ComponentActivity#ComponentActivity(int)

Summary

Public constructors

Annotation that can be attached to a constructor with a single LayoutRes parameter to denote what layout the component intends to inflate and set as its content.

Public constructors

<init>

ContentView()

Annotation that can be attached to a constructor with a single LayoutRes parameter to denote what layout the component intends to inflate and set as its content.

It is strongly recommended that components that support this annotation specifically call it out in their documentation.

 public class MainFragment extends Fragment { public MainFragment() { // This constructor is annotated with @ContentView super(R.layout.main); } } 
see androidx.activity.ComponentActivity#ComponentActivity(int)