ListView with JSON + PHP

0

I want to appear in a ListView all the information of a select that I gave. I can do just with txt appearing an information:

public void sendjsonrequest() {
    JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, HOST, null, new Response.Listener<JSONObject>() {
        @Override
        public void onResponse(JSONObject response) {

            try {

                contrato = response.getString("contrato");
                tipo = response.getString("tipo");
                horario = response.getString("horario");


                //txtContrato.setText(contrato);
                //txtTipo.setText(tipo);
                //txtHorario.setText(horario);
            } catch (
                    JSONException e)

            {
                e.printStackTrace();

            }
        }

I'm not sure how to enter this information into ListView .

contrato = response.getString("contrato");
tipo = response.getString("tipo");
horario = response.getString("horario");
    
asked by anonymous 21.09.2018 / 16:00

1 answer

0

To get these three data, create an object and fill it with that return of your php code.

public class MeuObjeto {
    private String Contrato, Tipo, Horario;
}

Then create a list with these objects; use the concept of Recyclerview to create a listview with this data.

    
21.09.2018 / 18:29