I have the following item.xml -
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="@+id/[id required here for click event.]"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Using this layout template I am creating multiple items in the code behind -
public Item(string title, Button btn)
{
Text = title;
Button = btn;
}
public override View GetView(int position, View convertView)
{
var item = Items[position];
var view = convertView;
var contentItem = (Item)item;
view = _inflater.Inflate(Resource.Layout.ListViewContentItem, null);
var title = view.FindViewById<TextView>(Resource.Id.txtTitle);
var btn = view.FindViewById<Button>([button id??]);
title.Text = contentItem.Text;
btn = contentItem.Button;
return view;
}
My understanding is that id's have to be unique, so how can I create buttons with unique id's so that I can access their click events?
My code would have to be able to handle the creation of multiple Items each with their own buttons.