Find custom ListView values

1

I have the following ListView that was generated with a custom adapter :

Iwouldliketoknowhowtolookupthevalues(date,time,history,id,etc)oftheitemwithsetOnItemLongClickListener,asIneedthesevalues(oratleasttheidvalueoftheitem)tosearchtheSQLiteandopeninanotherscreenforediting.

SofarI'vetesteditasfollows,butitonlybringsmethepositionoftheiteminthelist:

this.ltvRegistros.setOnItemLongClickListener(newAdapterView.OnItemLongClickListener(){@OverridepublicbooleanonItemLongClick(finalAdapterView<?>parent,finalViewview,finalintposition,longid){AlertDialog.Builderdialog=newAlertDialog.Builder(Main.this);dialog.setTitle("Editar");
                dialog.setMessage("Deseja editar o item ?");
                dialog.setPositiveButton("Sim", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        CRegistros item = (CRegistros) ltvRegistros.getAdapter().getItem(position);
                        Toast.makeText(Main.this, "Registro " + item.get_Id().toString() + " apagado !", Toast.LENGTH_SHORT).show();
                        DBController ct = new DBController(getBaseContext());
                        ct.buscaRegistro(id);
                    }
                });
                dialog.setNegativeButton("Não", null);
                dialog.show();
                return true;
            }
        });
    
asked by anonymous 05.02.2018 / 15:03

1 answer

1

Solved. My fault.

I am pulling item.get_Id() but the activity I was pulling does not have the field associating id . I made the association and it worked out.

Sometimes just passing through the steps to describe in a question, we find out by itself.

I'll leave the question as a file if it helps a neighbor.

I'm sorry.

    
05.02.2018 / 15:11