如何在android中使用列表数据

如何在android中使用列表数据,android,list,Android,List,在我的应用程序中,我希望使用此库: 我的数据是: "mostlyMatchedKeywordsText": [ "item1", "item2", "item3" ] 我在模型中创建如下数据: @SerializedName("mostlyMatchedKeywordsText") @Expose private String[] mostlyMatc

在我的应用程序中,我希望使用此

我的数据是:

"mostlyMatchedKeywordsText": [
      "item1",
      "item2",
      "item3"
    ]
我在模型中创建如下数据:

@SerializedName("mostlyMatchedKeywordsText")
@Expose
private String[] mostlyMatchedKeywordsText = null;

public String[] getMostlyMatchedKeywordsText() {
    return mostlyMatchedKeywordsText;
}

public void setMostlyMatchedKeywordsText(String[] mostlyMatchedKeywordsText) {
    this.mostlyMatchedKeywordsText = mostlyMatchedKeywordsText;
}
String[] chipCloudList;
chipCloudList = searchResponse.getData().getMostlyMatchedKeywordsText();
                fullSearchMini_chipCloud.addChips(chipCloudList);
                fullSearchMini_chipCloud.setChipListener(new ChipListener() {
                    @Override
                    public void chipSelected(int i) {
                        Toast.makeText(FullSearchMini.this, "" + i, Toast.LENGTH_SHORT).show();
                    }

                    @Override
                    public void chipDeselected(int i) {

                    }
                });
并在芯片视图中写入以下代码:

@SerializedName("mostlyMatchedKeywordsText")
@Expose
private String[] mostlyMatchedKeywordsText = null;

public String[] getMostlyMatchedKeywordsText() {
    return mostlyMatchedKeywordsText;
}

public void setMostlyMatchedKeywordsText(String[] mostlyMatchedKeywordsText) {
    this.mostlyMatchedKeywordsText = mostlyMatchedKeywordsText;
}
String[] chipCloudList;
chipCloudList = searchResponse.getData().getMostlyMatchedKeywordsText();
                fullSearchMini_chipCloud.addChips(chipCloudList);
                fullSearchMini_chipCloud.setChipListener(new ChipListener() {
                    @Override
                    public void chipSelected(int i) {
                        Toast.makeText(FullSearchMini.this, "" + i, Toast.LENGTH_SHORT).show();
                    }

                    @Override
                    public void chipDeselected(int i) {

                    }
                });
我想在点击此芯片时,显示位置的数据名称实例。
例如:显示0的item1实例


我该怎么做?请帮助我

只需将您的
chipCloudListchipCloudList
变量设置为最终变量,然后单击即可从内部访问

例: