从arraymap内的对象获取属性

时间:2019-02-21 21:58:45

标签: android

我正在创建一个名为“ partite”的类,这是代码

public class Partita {

    String HT;      //HomeTeam
    String AT;      //AwayTeam
    String dataP;   //dataPartita
    int HG;         //HomeGoal
    int AG;         //AwayGoal
    String FTR;     //Full time result

    public Partita(){
        this.HT = "";
        this.AT = "";
        this.dataP = "";
        this.HG = 0;
        this.AG = 0;
        this.FTR = "";
    }

    public Partita(String HT, String AT, String dataP, int HG, int AG, String FTR) {
        this.HT = HT;
        this.AT = AT;
        this.dataP = dataP;
        this.HG = HG;
        this.AG = AG;
        this.FTR = FTR;
    }
}

在主要活动中,我创建一个ArrayList,放置一些“ Partita”对象的列表,其属性来自json文件,然后创建一个ArrayMap并将{ {1}},像这样

ArrayList

如何使用ArrayMap而不是ArrayList来获取对象的属性并使用它?

1 个答案:

答案 0 :(得分:1)

使用它代替(编辑):

getInitialProps()