Skip to content

Quick start with the Renderer Adapter

Vitaly Vivchar edited this page Feb 21, 2018 · 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(getContext());

                ...
	}
}

3. Register your ViewBinder

public class SomeActivity extends AppCompatActivity {

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

		mRecyclerViewAdapter.registerRenderer(new AnyViewBinder());

                ...
	}
}

4. Set a data to the Renderer Adapter

public class SomeActivity extends AppCompatActivity {

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

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

                ...
	}
}