你好,我正在尝试创建一个自定义的可扩展列表视图,但适配器上的文档非常混乱和多样化。和往常一样,我有一个散列表来读取json数组,然后把它放在列表中。每个孩子的小组在最后一个位置的密钥“GRUPO”中的同一个阵列中发送。有人可以给我适配器实现吗?从JSON的代码如下所示:可扩展的列表视图android json
if (tipopergunta.contentEquals("BOOLEANO") || tipopergunta.contentEquals("ESCMULTIPLA") || tipopergunta.contentEquals("ESCUNICA")){
HashMap<String,String> childdados = new HashMap<String,String>();
childdados.put("GRUPO", "Dados");
childdados.put("TIPOPERGUNTA", tipopergunta);
childdados.put("PERGUNTA", pergunta);
childdados.put("BREVEDESIGNACAO", brevedesc);
childdados.put("ESTADO",estado);
childdados.put("INSTRUCOES",instrucoes);
childdados.put("IDPERGUNTA",idpergunta);
Log.d("childdados",""+childdados.toString());
list.add(childdados);
}
if (tipopergunta.contentEquals("OPINIAO")){
HashMap<String,String> childdados = new HashMap<String,String>();
childdados.put("GRUPO", "Opinião");
childdados.put("TIPOPERGUNTA", tipopergunta);
childdados.put("PERGUNTA", pergunta);
childdados.put("BREVEDESIGNACAO", brevedesc);
childdados.put("ESTADO",estado);
childdados.put("INSTRUCOES",instrucoes);
childdados.put("IDPERGUNTA",idpergunta);
Log.d("opiniaolist",childdados.toString());
list.add(childdados);
}
if (tipopergunta.contentEquals("FOTOGRAFIA")){
HashMap<String,String> childdados = new HashMap<String,String>();
childdados.put("GRUPO", "Fotografia");
childdados.put("TIPOPERGUNTA", tipopergunta);
childdados.put("PERGUNTA", pergunta);
childdados.put("BREVEDESIGNACAO", brevedesc);
childdados.put("ESTADO",estado);
childdados.put("INSTRUCOES",instrucoes);
childdados.put("IDPERGUNTA",idpergunta);
Log.d("fotolist",childdados.toString());
list.add(childdados);
}
我仍然无法理解。 ican在这里把我在图像适配器上得到的东西放在这里,我不知道如何在适配器上实现它。 – user1437481
我试着解释每种方法。看看它是否可以帮助你。 –