Saturday, 21 July 2018

DataBoundListAdapter with multiple item types

I am using DataBoundListAdapter from android architecture components example.

I need to enhance it to support multiple item types. Anybody did it already ? My problem is how to find out item type in createBinding procedure, as I do not have available item position there, but I need it to get item type to be able to inflate correct layout base on it.

@Override
    protected ChatMessageItemBinding createBinding(ViewGroup parent) {
        MyItemBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.my_item, parent,
                false, dataBindingComponent);


        return binding;
    }



from DataBoundListAdapter with multiple item types

No comments:

Post a Comment