Hey i got a json response which contain strings and arrays as well, fetching strings works fine but when tried to fetch array type data it gvies error in studio.
{
"body": [
{
"customer": "erp touch",
"description": [
"ythn",
"bgtr",
"ythn"
]
}
]
}
I am able to fetch customer but could not do it for description, here is the pojo i am using for description
@SerializedName("description")
private List<String> description = null;
public List<String> getDescription() {
return description;
}
And this is what i am using to get it
OrderListResponse orderListResponse = response.body().getBody();
description_tv.setText(orderListResponse.getDescription()); // this line give error cannot resolve setText(java.util.list<java.lang.string>)
NOTE: Please do not get confused with response.body().getBody() because i haven't posted the complete response.
Please tell me how to get this data any help will be appreciable.
THANKS!!
EDIT
Hey all actually i figured out with my mate that how we want to show this data in array, and i am havng problem with that.
I want to fetch this description array from json response and show its different elements in different textviews. Using ,
description_tv1.setText(orderListResponse.getDescription().get(0));
description_tv2.setText(orderListResponse.getDescription().get(1));
description_tv3.setText(orderListResponse.getDescription().get(2));
will resolve the problem but elements in array can vary up to any number so in actual i dont know how many textviews i should use, this is the real problem.
Is there any way that i can create textviews according to my problems ?
Any suggestion or help will appreciated.
THANKS AGAIN !
List<String>totext view, which is expecting astringdescription_tv.setText(orderListResponse.getDescription().get(0));