2017-02-07 1 views
-3

J'ai créé un getter setter dans Array List, et je veux les afficher dans mon activité.Comment faire une boucle de setter getter dans android?

C'est mon code

response = (ProductListResponse) getIntent().getSerializableExtra("response"); 
     category = response.getListCategory(); 
     list = response.getListCategory().get(0).getProductList(); 

de get(0), je ne suis arrivé l'indice 0 de ma réponse. Alors, comment obtenir l'indice tout? merci

+0

encore si vous n'obtenir une solution alors s'il vous plaît poster votre réponse JSON here.I imprimera arraylist de réponse de JSON. – dipali

Répondre

0

Vous pouvez utiliser la boucle pour que, comme ce

for(int i=0;i<response.getListCategory().size();i++){ 
list = response.getListCategory().get(i).getProductList();; // use list 
} 

ou vous pouvez utiliser foreach

for(datamodel data:response.getListCategory()){ 
list=data.getProductList(); //use the list 
}