I am using two ListView in same screen,Because of using two Listviews
likely Parent ListView
and Child ListView
,that Child ListView Adapter
class doesn't show all List Values in Child ListView.It showed only 0 th(first)
position in Child ListView,for this above issue I have used the answer code from this Android list view inside a scroll view link.now I can see all list values in my Child ListView
but It is not showing all my List values in same time which I had grabbed from Web service call
.It showed first value only in list because the List View height was set to list's single item height.If I scroll down the Child ListView I am able to see all values in ListView.What I need is If i get five list values from Web service It has to show all five items in same time.
note: If I set hard coded values for List,It showed all items in Child ListView at one time.
Edited
How I achieved it using MergeAdapter
This createAdapter
method would return Adapter
object and I have set that Adapter into my Listview using setAdapter(createAdapter(new ArrayList<T>()))
private ListAdapter createAdapter(List<T> items) {
mergeAdapter = new MergeAdapter();
mergeAdapter.addAdapter(endlessFeedAdapter);
return mergeAdapter;
}
What I need is
I Have been suggested to use ExpandableListView
instead of using two ListViews
.
If I use ExpandableListView
I will have to change the createAdapter
method return type into ExpandableListAdapter
for this I used below code
private ExpandableListAdapter createAdapter(List<T> items) {
mergeAdapter = new MergeAdapter();
mergeAdapter.addAdapter(endlessFeedAdapter);
return (ExpandableListAdapter) mergeAdapter;
}
but it showed the below Excaption
Caused by: java.lang.ClassCastException: com.commonsware.cwac.merge.MergeAdapter cannot be cast to android.widget.ExpandableListAdapter
Values from Web service
Hard coded values