Generated component classes provide a simple builder with the props you defined in your component spec. In order to use the generated component in your UI, you’ll need a LithoView, which is an Android ViewGroup that is able to render components.

You can assign a component to be rendered by a LithoView as follows:

final Component component = MyComponent.create()
    .title("My title")
LithoView view = LithoView.create(context, component);

In this example, MyComponent will be laid out by the hosting LithoView, which you can use in your application as you would normally use an Android View. See the tutorial for an example on how to use it in an Activity.

IMPORTANT: The LithoView from this example, if directly used in your view hierarchy as is, will perform layout synchronously on the main thread. For more information about performing layout off the main thread, see Async Layout.

Edit on GitHub