Skip to content

Quick start with the Renderer Adapter

Vitaly Vivchar edited this page Oct 19, 2017 · 9 revisions

To use the RendereRecyclerViewAdapter you should:

  1. Initialize the RendererRecyclerViewAdapter
public class SomeActivity extends AppCompatActivity {

	private RendererRecyclerViewAdapter mRecyclerViewAdapter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
                ...

		mRecyclerViewAdapter = new RendererRecyclerViewAdapter();

                ...
	}
}
  1. Create a ViewRenderer or a CompositeViewRenderer

  2. Register your ViewRenderer

public class SomeActivity extends AppCompatActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
                ...

		mRecyclerViewAdapter.registerRenderer(new AnyViewRenderer());

                ...
	}
}
  1. Set a data to the Adapter
public class SomeActivity extends AppCompatActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
                ...

		mRecyclerViewAdapter.setItems(getItems());
		mRecyclerViewAdapter.notifyDataSetChanged();

                ...
	}
}