Android中回收视图的Json解析器?
我的json:Android中回收视图的Json解析器?,android,json,android-recyclerview,Android,Json,Android Recyclerview,我的json: { "info": [ { "key": "headache", "value": false }, { "key": "fatigue", "value": false }, {
{
"info": [
{
"key": "headache",
"value": false
},
{
"key": "fatigue",
"value": false
},
{
"key": "soreMusclesJoints",
"value": false
},
{
"key": "soreThroat",
"value": false
}
]
}
我正在尝试:
List<Test1.InfoBean> infoBeanList = new ArrayList<>();
JSONObject jsonObject = new JSONObject(myJson1.toString());
JSONArray array = jsonObject.getJSONArray("info");
for(int i=0; i < array.length(); i++){
JSONObject object = array.getJSONObject(i);
String key = object.getString("key");
boolean value = (boolean) object.get("value");
infoBeanList.add(new Test1.InfoBean());
}
List infoBeanList=new ArrayList();
JSONObject JSONObject=新的JSONObject(myJson1.toString());
JSONArray数组=jsonObject.getJSONArray(“info”);
对于(int i=0;i
Test1.java
private List<InfoBean> info;
public Test1(List<InfoBean> info){this.info = info;}
私有列表信息;
公共测试1(列表信息){this.info=info;}
我知道我没有将“键”和“值”传递给适配器,哪个部分是错误的
请帮助我,thanskTest1.InfoBean类
公共类InfoBean{
私钥;
私有布尔值;
公共InfoBean(字符串键,布尔值){
this.key=key;
这个值=值;
}
}
主块码
List infoBeanList=new ArrayList();
JSONObject JSONObject=新的JSONObject(myJson1.toString());
JSONArray数组=jsonObject.getJSONArray(“info”);
对于(int i=0;iadd(newtest1.InfoBean(key,value));