Code example for GridView

Methods: getAdapter, getSelectedItemPosition

0
     
    @Override 
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_DEL) {
            GridView g = getGridView();
            ((DeleteAdapter)g.getAdapter()).deletePosition(g.getSelectedItemPosition());
            return true; 
        } else { 
            return super.onKeyDown(keyCode, event);
        } 
    } 
 
 
 
 
    private class DeleteAdapter extends BaseAdapter {
         
        private ArrayList<Integer> mData;
         
        public DeleteAdapter(int initialNumItems) {
Connect your IDE to all the code out there  Get Codota for Java