I want to have multiple listViews
underneath each one of my RecyclerView
items. Initially, each one will be hidden, but when the user taps on a call log item, the item will expand, revealing the details underneath, as seen below. I have a List
variable, which holds all available log details, and which I pass into my ListView:
mLogsList.setAdapter(new HistoryLogAdapter(
view.getContext(), R.layout.history_detail_cell, mLogs));
When I print mLogs out, it shows all available log details, but when I pass it onto the RecyclerView
item, it always just displays the first log, for all entries.
Any ideas as to what I am doing wrong?
Further context:
List<CallLog> mLogs = Arrays.asList(LinphoneManager.getCore().getCallLogs());
CallLog log = mLogs.get(getAdapterPosition());
Address address = log.getFromAddress();
String mSipUri = (address != null) ? address.asString() : "";
if (mSipUri != null) {
address = Factory.instance().createAddress(mSipUri);
Core core = LinphoneManager.getCore();
if (address != null && core != null) {
address.clean();
ProxyConfig proxyConfig = core.getDefaultProxyConfig();
CallLog[] logs;
if (proxyConfig != null) {
logs = core.getCallHistory(address, proxyConfig.getIdentityAddress());
} else {
logs = core.getCallHistoryForAddress(address);
}
mLogsList.setAdapter(
new HistoryLogAdapter(
view.getContext(), R.layout.history_detail_cell, mLogs));
mLogsList.setVerticalScrollBarEnabled(false);
mLogsList.setEnabled(false);
}
I really appreciate your effort but in my opinion, you can treat your listItem as a section. There is a very good and handy library for expandable RecyclerView. Your case is very popular and personally I faced this before. So I recommend using this library It would provide you with a solution for sectioned RecyclerView. and to be me more specific you can see this example for expandable sectioned RecyclerView.
I hope this would help.