如何从该模型类中获取列表?我尝试了几种方法,但是程序什么也不返回。如果可以的话,不要给我完整的解决方案,而只是给我一个提示。我不想有复制+粘贴项目(很正常,现在是)。我希望将其包含在列表中,因为我将在textview中获取所有货币的值,仅向用户显示acutall货币兑换
我的模型班
public class Model {
@SerializedName("base")
private String base;
@SerializedName("rates")
private Rates rates;
public Rates getRates() {
return rates;
}
public void setRates(Rates rates) {
this.rates = rates;
}
public void setBase(String base) {
this.base = base;
}
public String getBase() {
return base;
}
class Rates {
@SerializedName("BGN")
private Double bGN;
@SerializedName("NZD")
private Double nZD;
@SerializedName("ILS")
private Double iLS;
@SerializedName("RUB")
private Double rUB;
@SerializedName("CAD")
private Double cAD;
@SerializedName("USD")
private Double uSD;
@SerializedName("PHP")
private Double pHP;
@SerializedName("CHF")
private Double cHF;
@SerializedName("ZAR")
private Double zAR;
@SerializedName("AUD")
private Double aUD;
@SerializedName("JPY")
private Double jPY;
@SerializedName("TRY")
private Double tRY;
@SerializedName("HKD")
private Double hKD;
@SerializedName("MYR")
private Double mYR;
@SerializedName("THB")
private Double tHB;
@SerializedName("HRK")
private Double hRK;
@SerializedName("NOK")
private Double nOK;
@SerializedName("IDR")
private Double iDR;
@SerializedName("DKK")
private Double dKK;
@SerializedName("CZK")
private Double cZK;
@SerializedName("HUF")
private Double hUF;
@SerializedName("GBP")
private Double gBP;
@SerializedName("MXN")
private Double mXN;
@SerializedName("KRW")
private Double kRW;
@SerializedName("ISK")
private Double iSK;
@SerializedName("SGD")
private Double sGD;
@SerializedName("BRL")
private Double bRL;
@SerializedName("PLN")
private Double pLN;
@SerializedName("INR")
private Double iNR;
@SerializedName("RON")
private Double rON;
@SerializedName("CNY")
private Double cNY;
@SerializedName("SEK")
private Double sEK;
public Double getBGN() {
return bGN;
}
public void setBGN(Double value) {
this.bGN = value;
}
public Double getNZD() {
return nZD;
}
public void setNZD(Double value) {
this.nZD = value;
}
public Double getILS() {
return iLS;
}
public void setILS(Double value) {
this.iLS = value;
}
public Double getRUB() {
return rUB;
}
public void setRUB(Double value) {
this.rUB = value;
}
public Double getCAD() {
return cAD;
}
public void setCAD(Double value) {
this.cAD = value;
}
public Double getUSD() {
return uSD;
}
public void setUSD(Double value) {
this.uSD = value;
}
public Double getPHP() {
return pHP;
}
public void setPHP(Double value) {
this.pHP = value;
}
public Double getCHF() {
return cHF;
}
public void setCHF(Double value) {
this.cHF = value;
}
public Double getZAR() {
return zAR;
}
public void setZAR(Double value) {
this.zAR = value;
}
public Double getAUD() {
return aUD;
}
public void setAUD(Double value) {
this.aUD = value;
}
public Double getJPY() {
return jPY;
}
public void setJPY(Double value) {
this.jPY = value;
}
public Double getTRY() {
return tRY;
}
public void setTRY(Double value) {
this.tRY = value;
}
public Double getHKD() {
return hKD;
}
public void setHKD(Double value) {
this.hKD = value;
}
public Double getMYR() {
return mYR;
}
public void setMYR(Double value) {
this.mYR = value;
}
public Double getTHB() {
return tHB;
}
public void setTHB(Double value) {
this.tHB = value;
}
public Double getHRK() {
return hRK;
}
public void setHRK(Double value) {
this.hRK = value;
}
public Double getNOK() {
return nOK;
}
public void setNOK(Double value) {
this.nOK = value;
}
public Double getIDR() {
return iDR;
}
public void setIDR(Double value) {
this.iDR = value;
}
public Double getDKK() {
return dKK;
}
public void setDKK(Double value) {
this.dKK = value;
}
public Double getCZK() {
return cZK;
}
public void setCZK(Double value) {
this.cZK = value;
}
public Double getHUF() {
return hUF;
}
public void setHUF(Double value) {
this.hUF = value;
}
public Double getGBP() {
return gBP;
}
public void setGBP(Double value) {
this.gBP = value;
}
public Double getMXN() {
return mXN;
}
public void setMXN(Double value) {
this.mXN = value;
}
public Double getKRW() {
return kRW;
}
public void setKRW(Double value) {
this.kRW = value;
}
public Double getISK() {
return iSK;
}
public void setISK(Double value) {
this.iSK = value;
}
public Double getSGD() {
return sGD;
}
public void setSGD(Double value) {
this.sGD = value;
}
public Double getBRL() {
return bRL;
}
public void setBRL(Double value) {
this.bRL = value;
}
public Double getPLN() {
return pLN;
}
public void setPLN(Double value) {
this.pLN = value;
}
public Double getINR() {
return iNR;
}
public void setINR(Double value) {
this.iNR = value;
}
public Double getRON() {
return rON;
}
public void setRON(Double value) {
this.rON = value;
}
public Double getCNY() {
return cNY;
}
public void setCNY(Double value) {
this.cNY = value;
}
public Double getSEK() {
return sEK;
}
public void setSEK(Double value) {
this.sEK = value;
}
}
答案 0 :(得分:0)
在您的活动中创建一个ArrayList对象,如下所示:-
ArrayList<Model> modelList = new ArrayList();
现在将数据添加到modelList中,并在所需的位置使用此列表。