List data in an Android ListView

0

I'm having a bit of a question when listing specific data in a table with ListView . When I use a method to list, I get all records from the table, but I would like to filter those data by id and play in ListView .

With the method below I can list all the requests of the table, how do I list the requests of a specific id , passing by parameter id .

@Override
    protected void onStart(){
        super.onStart();
        final ListView lista = (ListView) findViewById(R.id.lvPedidos);

        dialog = new ProgressDialog(StatusActivity.this);
        dialog.setMessage("Carregando...");
        dialog.setCancelable(false);
        dialog.show();

        Call<List<Pedidos>> call = ApiClient.getUsuario().getPedidos();
        call.enqueue(new Callback<List<Pedidos>>() {
            @Override
            public void onResponse(Call<List<Pedidos>> call, Response<List<Pedidos>> response) {
                if (dialog.isShowing())
                    dialog.dismiss();

                final List<Pedidos> listaPedidos = response.body();
                if (listaPedidos!=null){
                    PedidosAdapter adapter = new PedidosAdapter(getBaseContext(), listaPedidos);
                    lista.setAdapter(adapter);
                    Log.d("my_tag", "Entrou no Onresponse: " + response.body());
                } else {
                    Log.d("my_tag", "Entrou no else: " + response.body());
                }

            }

            @Override
            public void onFailure(Call<List<Pedidos>> call, Throwable t) {
                if (dialog.isShowing())
                    dialog.dismiss();
                Toast.makeText(getBaseContext(), "Problema de acesso", Toast.LENGTH_LONG).show();

            }
        });
}
    
asked by anonymous 15.03.2017 / 09:04

0 answers