I have an app that lists items in a listview which is populated from Parse.com and when I add new items to listview it adds to Parse.com That is working fine but I also have a popup context menu window that appears when you longpress the item. I can get it to remove the item from the list but not to delete from Parse.com
Can anyone please help me?
This is my code for the context window;
`@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
menu.setHeaderTitle("Options");
getMenuInflater().inflate(R.menu.action, menu);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
String name = Name.getText().toString();
switch (item.getItemId()) {
case R.id.cnt_mnu_x2:
Toast.makeText(this, "", Toast.LENGTH_SHORT).show();
break;
case R.id.cnt_mnu_custom:
Toast.makeText(this, "TEST SELECTED", Toast.LENGTH_SHORT).show();
break;
case R.id.cnt_mnu_delete:
adapter.remove(adapter.getItem(info.position));
Toast.makeText(this, "Deleted", Toast.LENGTH_SHORT).show();
break;
}
return true;
}`