I have a list view filled with data. I set up a context menu for the listview using the following code:
list.setOnCreateContextMenuListener
(
new View.OnCr
OK, to solve problem info null **** use static member and set value from Position of your holder to save the value in longclick method member for example:-
public class CurrentPosition {
public static int Pos{ get; set; }
}
public bool OnLongClick(View v)
{
CurrentPosition.Pos = Position;
return false;
}
and use in your context select item:
public override bool OnContextItemSelected(IMenuItem item)
{
switch (item.ItemId)
{
case 0:
return true;
case 1:
Toast.MakeText(this,CurrentPosition.Pos.ToString(), ToastLength.Long).Show();
return true;
case 2:
Toast.MakeText(this, "Save", ToastLength.Long).Show();
return true;
}
return true;
}
}
C# code