views:

14

answers:

1

I have a ListView and would like to remove a row item when the user long clicks on selects Remove from the context menu.

@Override  
    public void onCreateContextMenu(ContextMenu menu, View v,ContextMenuInfo menuInfo) {  

        super.onCreateContextMenu(menu, v, menuInfo);  
        menu.setHeaderTitle("Selection Options");  
        menu.add(0, v.getId(), 0, "Remove Symbol");  
    }  

    @Override  
    public boolean onContextItemSelected(MenuItem item) {  
        if(item.getTitle()=="Remove Symbol"){
            Toast.makeText(this, "Remove clicked!", Toast.LENGTH_SHORT).show();
        }  
        else {
            return false;
        }  

        return true;  
    }  

How can I get a reference to the row number that was clicked, so I can remove that index from my array?

A: 
Austyn Mahoney