I've made a setter getter in Array List, and I want to show them up in my activity.
This is my code
response = (ProductListResponse) getIntent().getSerializableExtra("response");
category = response.getListCategory();
list = response.getListCategory().get(0).getProductList();
from get(0)
, i only got index 0 from my response. So, How to get the all index? thank you
You can use for loop for that like this
for(int i=0;i<response.getListCategory().size();i++){
list = response.getListCategory().get(i).getProductList();; // use list
}
or you can use foreach
for(datamodel data:response.getListCategory()){
list=data.getProductList(); //use the list
}