Hello!
I'm want to delete a row from my sql database with help of SubMenu in
ContextMenu  but get en error when try to get  AdapterContextMenuInfo
info.id.
How can I get my items id from submenu?

public class MainActivity extends ListActivity {
...
  private DBAdapter dbHelper;
...
 this.getListView().setDividerHeight(2);
 dbHelper = new DBAdapter(this);
 dbHelper.open();

...

 @Override
 public void onCreateContextMenu(ContextMenu menu, View v,
 ContextMenuInfo menuInfo) {
 super.onCreateContextMenu(menu, v, menuInfo);
  SubMenu manageClients = menu.addSubMenu(R.string.manageClients);
 manageClients.add(CLIENTS, DELETE_ID, 0, R.string.deleteClient);

 }

 @Override
 public boolean onContextItemSelected(MenuItem item) {
 final AdapterContextMenuInfo info = (AdapterContextMenuInfo) item
 .getMenuInfo();
 switch (item.getItemId()) {
  case DELETE_ID:
  dbHelper.deleteContact(info.id);
 return true;
 }
 return super.onContextItemSelected(item);
 }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to