I have a table which is built dynamically based on how much data is present, if at all.
I want to be able to long press anywhere on a the table row to be able to get some options to delete or edit etc. Is this possible? Remember I need to do all this without setting any XML as its dynamically built.
Is this relevant to what I want to achieve?
@override
public boolean onKeyLongPress(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK)
{
// do your stuff here
return true;
}
return super.onKeyLongPress(keyCode, event);
}
`
any advice is appreciated.
Register context menu to dynamically created Table Row .
call
registerForContextMenu(tableRow)and overrideonCreateContextMenu(ContextMenu, View, ContextMenu.ContextMenuInfo).Read about Context Menu