0

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;
    }`
Tanim reja
  • 2,120
  • 1
  • 16
  • 23
T-BONE
  • 61
  • 9
  • so just remove a listview row? checkout this question: http://stackoverflow.com/questions/7372301/how-do-i-delete-an-item-from-my-custom-base-adapter – Surely May 09 '15 at 02:51
  • Thanks but I can already remove the item from the list by using; adapter.remove(adapter.getItem(info.position)); I just need to delete the item from Parse.com aswell – T-BONE May 09 '15 at 02:57
  • sorry, but I think you can just rephrase your question to how to remove item from Parse.com. And I just google it, found: https://www.parse.com/questions/delete-row. – Surely May 09 '15 at 03:17

0 Answers0