I'm inflating linearlayouts in a linear layout, by doing this:
LinearLayout parent = ((LinearLayout) findViewById(R.id.main_parent));
for (int i = 0; i < 3; i++) {
View r = LayoutInflater.from(getBaseContext()).inflate(
R.layout.main_item, parent, false);
ImageView itemBg = (ImageView) r.findViewById(R.id.main_item_img);
TextView title = (TextView) r.findViewById(R.id.main_item_title);
TextView time = (TextView) r.findViewById(R.id.main_item_time);
TextView persons = (TextView) r
.findViewById(R.id.main_item_persons);
String imgLink = withoTechnics.get(i).getImage_1()
.replace("[HEIGHT]", parent.getHeight() + "")
.replace("[WIDTH]", (int) parent.getWidth() / 3 + "");
Log.v("--", imgLink);
title.setText(withoTechnics.get(i).getTitle());
time.setText(withoTechnics.get(i).getPreparation_time());
persons.setText(withoTechnics.get(i).getPersons() + "");
ImageLoader.getInstance().displayImage(imgLink, itemBg);
parent.addView(r);
}
Now can I set on item click listener by executing this code, or what I need to modify so I can set the onitemclicklistener for these objects?