1
I have a code that I get the ID of the item clicked on ListView
and step into another Activity
, but I would like to get the name clicked and not the ID.
My code:
if (controle != null) {
controle.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> av, View v, int position, long id) {
Intent it = new Intent(layout_projetos_c.this, layout_projetos_c_info.class);
it.putExtra("idProjeto", id);
startActivityForResult(it, 1);
}
});
}
And in the other Activity I get the id value
long idCli;
idCli = getIntent().getLongExtra("idProjeto", 0);
How can I get the selected item name instead of the ID?
Thanks Thiago, but I still could not solve my problem, in my case the listview items were pulled from a Database of the project table that has some fields, among them the field "project name" this field goes to the list. Suppose I have 3 projects in the List "Project_a, Project_b and Project_c" and when clicking on Project_b I want you to call another Activity with the project data?
– Italo Teixeira
take your ID to Outra Activity, there you go to the bank and query all your data....
– Thiago Luiz Domacoski