first of all add both items in list using following code:
list.add(model(name, roomid));
Also create a model class for RoomModel like this:
public class RoomModel {
public String name, id, image, description;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
and create a model in your activity class like this:
private RoomModel model(String id, String name) {
RoomModel m= new RoomModel();
m.setId(id);
m.setName(name);
return m;
}
Now in OnItemClickListener call:
Toast.makeText(getApplicationContext(),roomlist.get(position).getId());, Toast.LENGTH_LONG)
.show();
5
solved Unable to show Toast