2
我對Android並不陌生,但今天開始使用改造,我能夠清除所有錯誤,現在響應主體返回null。我知道這與我的班級建立的方式有關。我不知道如何處理數組的數組。任何幫助,將不勝感激。由於如何使用翻新處理JSON數組對象?
[
我的接口
@GET("/web-api.php?route=feed/web_api/products")
Call<Product> loadProducts(@Query("category") Integer id, @Query("key") String apiKey);
類
public class Product implements Serializable {
@SerializedName("id")
private long mId;
@SerializedName("name")
private String mname;
@SerializedName("description")
private String mText;
@SerializedName("price")
private Double mprice;
@SerializedName("href")
private String mproductURL;
@SerializedName("thumb")
private String mImageURL;
public Product(long mId, String mname, String mText, Double mprice, String mproductURL, String mImageURL) {
this.mId = mId;
this.mname = mname;
this.mText = mText;
this.mprice = mprice;
this.mproductURL = mproductURL;
this.mImageURL = mImageURL;
}
public long getmId() {
return mId;
}
public void setmId(long mId) {
this.mId = mId;
}
public String getMname() {
return mname;
}
public void setMname(String mname) {
this.mname = mname;
}
public String getmText() {
return mText;
}
public void setmText(String mText) {
this.mText = mText;
}
public Double getMprice() {
return mprice;
}
public void setMprice(Double mprice) {
this.mprice = mprice;
}
public String getMproductURL() {
return mproductURL;
}
public void setMproductURL(String mproductURL) {
this.mproductURL = mproductURL;
}
public String getmImageURL() {
return mImageURL;
}
public void setmImageURL(String mImageURL) {
this.mImageURL = mImageURL;
}
@Override
public String toString() {
return mText;
}
}
你改造類不匹配的響應。你需要一個具有布爾值的對象和一個產品的Arraylist –