Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android中回收视图的Json解析器?_Android_Json_Android Recyclerview - Fatal编程技术网

Android中回收视图的Json解析器?

Android中回收视图的Json解析器?,android,json,android-recyclerview,Android,Json,Android Recyclerview,我的json: { "info": [ { "key": "headache", "value": false }, { "key": "fatigue", "value": false }, {

我的json:

    {
      "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;}
我知道我没有将“键”和“值”传递给适配器,哪个部分是错误的

请帮助我,thansk

Test1.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));