Modify selected element of a GridView filled with TextView

0

I find a class exercise in which I have a GridView to which I have put an Adapter , this is filled with TextView , which have a number each.

The functionality of my program is to know if any number that I select from my GridView has already come out previously (in a superior panel, the functionality is like that of a bingo).

Therefore, I press any number, I display a ContextMenu , and it gives me the option to disable it. Now the problem arises in how to disable that number.

I have tried to access the adapter and choose the selected item, but then it will not let me cast it to do anything with it.

  @Override
    public boolean onContextItemSelected(MenuItem item) {
        AdapterView.AdapterContextMenuInfo menuInfo = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
        switch (item.getItemId()) {
            case R.id.menuMarcar:
                if (comprobarNumero((Integer) gridView.getAdapter().getItem(menuInfo.position))) {//Llamo a la funcion comprobar numero
                  //EN ESTA PARTE DEBERIA DE PODER DESHABILITAR LA CASILLA DEL GRIDVIEW CON EL NUMERO QUE YA HA SALIDO


                }

                return true;

        }
        return super.onContextItemSelected(item);
    }
    
asked by David Sanchez Calvo 25.12.2018 в 16:58
source

0 answers