facing problem while creating horizontal listview inside listview custom row. Problem is that, first row of listview is having 3 items i.e. A, B C. and second row of listview , having 6 items in horizontal list view i.e. A,B,C, D,E,F.
I am not able to get out of this problem.
Here is code snippets
Creating 3 arraylist
List<SectionArea> sectionAreas;
List<BannerArea> bannerAreas;
List<Wrapper> wrappers;
Code to fetch json data from server
wrappers = new ArrayList<Wrapper>();
// Code to get all wrapper in Icons list
JSONArray wrapperArray = object.getJSONArray("wrapper");
for (int i = 0; i < wrapperArray.length(); i++) {
sectionAreas = new ArrayList<SectionArea>();
bannerAreas = new ArrayList<BannerArea>();
JSONObject wrapperObj = wrapperArray.getJSONObject(i);
String section_image = wrapperObj.getString("section_image");
String category_id = wrapperObj.getString("category_id");
String category_name = wrapperObj.getString("category_name");
String banner_title = wrapperObj.getString("banner_title");
JSONArray sectioArray = wrapperObj.getJSONArray("sectionarea");
for (int j = 0; j < sectioArray.length(); j++) {
JSONObject jsonObject = sectioArray.getJSONObject(j);
String product_id = jsonObject.getString("product_id");
String sec_category_id = jsonObject.getString("category_id");
String name = jsonObject.getString("name");
String image = jsonObject.getString("image");
String price = jsonObject.getString("price");
String special = jsonObject.getString("special");
String discount = jsonObject.getString("discount");
SectionArea sectionArea = new SectionArea(product_id, sec_category_id, name, image, price, special, discount);
sectionAreas.add(sectionArea);
}
JSONArray bannerAreaArray = wrapperObj.getJSONArray("bannerarea");
for (int k = 0; k < bannerAreaArray.length(); k++) {
JSONObject jsonObject = bannerAreaArray.getJSONObject(k);
String image = jsonObject.getString("image");
String tag = jsonObject.getString("tag");
String id = jsonObject.getString("id");
BannerArea bannerArea = new BannerArea(image, tag, id);
bannerAreas.add(bannerArea);
}
Wrapper wrapper = new Wrapper(section_image, category_id, category_name, banner_title,
sectionAreas, bannerAreas);
wrappers.add(wrapper);
}
}
Adding adapter
list.setAdapter(new HomePageAdapter(context, wrappers));
Adapter code for setting Horizontal list view
sectionAreas = wrappers.get(position).getSectionAreas();
viewHolder.item_list.setAdapter(new HorizontaListAdapter(mContext, sectionAreas));
Please help. Thanks in advance