In the onCreate add a check before building the menu.
Assuming your list items adapter object is called listItemsAdapter
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
if(info != null)
{
if (v.getId()==R.id.list) {
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo)menuInfo;
menu.add(getString(R.string.Delete));
}
}
Is it when you click on an empty cell or a cell which has a value. If it is only an empty cell then I have modified the code accordingly.