I have an Array List where I store the subjects with the respective notes of a given student.
This array has only 2 attributes:
nameDiscipline valueNote
I would like to know how to fill a listview with all the disciplines and notes stored in this array.
Note: So it appears in 2 columns, the first with the DISCIPLINES heading and the second with the NOTES heading.
ArrayList<Nota> listNotas = new ArrayList<>();
public ArrayList buscarNotas(String matricula, int etapa){
try {
SoapObject resposta = new SoapObject(NAMESPACE, METHOD_NAME);
resposta.addProperty("Matricula", matricula);
resposta.addProperty("Etapa", etapa);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(resposta);
HttpTransportSE http = new HttpTransportSE(URL);
http.call(SOAP_ACTION, envelope);
String resultado = envelope.getResponse().toString();
JSONArray jsonArray = new JSONArray(resultado);
for(int i=0;i<jsonArray.length();i++ ) {
Nota nota = new Nota();
JSONObject jsonObject =jsonArray.getJSONObject(i);
nota.setDisciplina(jsonObject.getString("Materia"));
nota.setNota(jsonObject.getString("VlrNota"));
listNotas.add(i,nota);
}
} catch (HttpResponseException e) {
e.printStackTrace();
} catch (SoapFault soapFault) {
soapFault.printStackTrace();
} catch (XmlPullParserException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
return listNotas;
}