This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Android and the fly likes onContextItemSelected method for a table row Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "onContextItemSelected method for a table row " Watch "onContextItemSelected method for a table row " New topic

onContextItemSelected method for a table row

Florin Florentin
Ranch Hand

Joined: May 12, 2009
Posts: 43

I am creating an activity which contains one table. When selecting a row, i want to update or delete the row through context menu options.
The table is within TableLayout view. Each row is added to the TableLayout as a TableRow view, and also for each TableRow i registered it for context menu with registerForContextMenu(tr);

The context menu options are displaied when selecting a row, but the problem is that i need the number of the selected row . I tought that this could be achieved with the following source code in the onContextItemSelected( MenuItem item ) method :

but the AdapterContextMenuInfo is always null.

Could i achieve the table row by other method?
I agree. Here's the link:
subject: onContextItemSelected method for a table row
Similar Threads
String and Numeric Parameters
How to add a textview dynamically in a table row in table layout
B&S: Delete Problem with last row in JTable, getSelectedRow() return wrong row index
Weird problem with Custom Listview and CheckedTextView
Table Layout - Size of a widget