0

I'm trying to figure out how I can include an id for a listview item.

Currently I am querying a rest api that returns a list of something similar to this.

{ id : 100 name : "John Doe" }

It the listview I display all the names and once someone click on one item it forwards it to another activity where I want to use the id and get more data for that particular user.

So my questions are how can I get the ID and also pass the ID to the new activity. (The list is not sorted so the ids are not in order.)

I've read about hidden textview values and also hash maps but not sure how to use them, could someone give an example please?

Sameera Thilakasiri
  • 9,452
  • 10
  • 51
  • 86
jake
  • 1

1 Answers1

1

Do one thing, you have to set the id in setTag

view.setTag("id");

Refer : What is the main purpose of setTag() getTag() methods of View?

Community
  • 1
  • 1
jennifer
  • 8,133
  • 22
  • 69
  • 96