I am inflating the passenger_details_layout
in main_passenger_details_layout
.At run time i am setting the values in TextView . I am setting up pax_id
that is invisible for every row that i am inflating in it.So on click of passenger_details_layout i want to call a new activity and pass the pax_id
to the new activity.
Pax_id
will be like 1,2,3 for every time for loop will run.So on click of 1 row i want to get the pax_id
of first row that i have set.
Please help how could i do this Will be thank full to you.
Code to Infalate
ItinResponse data = obj.parseXMLData(fXmlFile);
List<SectorRecords> sectorList = data.getSectorRecordsDetails();
int items = 0;
List<PassengerDetails> listdata = data.getPaxDetails();
int i = 0;
for (PassengerDetails elements : listdata) {
inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
RelativeLayout layout = (RelativeLayout) inflater.inflate(
R.layout.passenger_details_layout, main, false);
firstName = (TextView) layout.findViewById(R.id.first_pax_name);
pax_id = (TextView) layout.findViewById(R.id.pax_id);
firstName.setText(elements.getFirstName() + " "
+ elements.getLastName());
pax_id.setText(elements.getPaxId());
main.addView(layout, i);
i++;
layout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(), "this is my Toast message!!! =)"+pax_id.getText(), Toast.LENGTH_LONG).show();
}
});
On every row is showing the last pax id