I am Using GSON and Volley library for networking in my android application but while converting the Json response to Model classes using Gson i am getitng the following err
problem solved, I am doing a foolish call To Gson because i am obtaining a Product class that contains list of other Classes(Result.class etc) but i am sending Product[].class to Gson to convert Hence it thrown exception.
Your model having private attribute you must create setter for the same or create constructor with all parameter like below:
public class Product {
private String status;
private List<Result> results = new ArrayList<Result>();
private Pagination pagination;
public void setStatus(String status) {
this.status = status;
}
public void setResults(List<Result> results) {
this.results = results;
}
public void setPagination(Pagination pagination) {
this.pagination = pagination;
}
}
or
public class Product {
private String status;
private List<Result> results = new ArrayList<Result>();
private Pagination pagination;
public Product(String status, List<Result> results, Pagination pagination) {
this.status = status;
this.results = results;
this.pagination = pagination;
}
}
Add default constructor for all classes. Example:
public class Product{
public Product(){
}
}
Just add an no argument constructor for the Bean class.
public class Product{
public Tweet(){
}
}