I created a gridView. Now how do I call an intent from the gridview icons?

0

Follow the gridview code. It is in this same activity that I want to call the grid actions.

//Grid VIew...set grid view item
Bitmap homeIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.teste_cor);
Bitmap userIcon1 = BitmapFactory.decodeResource(this.getResources(), R.drawable.teste_fest);
Bitmap userIcon2 = BitmapFactory.decodeResource(this.getResources(), R.drawable.teste_paris);
Bitmap userIcon3 = BitmapFactory.decodeResource(this.getResources(), R.drawable.teste_news);
Bitmap userIcon4 = BitmapFactory.decodeResource(this.getResources(), R.drawable.teste_media);
Bitmap userIcon5 = BitmapFactory.decodeResource(this.getResources(), R.drawable.local_gar);

gridArray.add(new Item(homeIcon,"menu1"));
gridArray.add(new Item(userIcon1,"menu2"));
gridArray.add(new Item(userIcon2,"menu3"));
gridArray.add(new Item(userIcon3,"menu4"));
gridArray.add(new Item(userIcon4,"menu5"));
gridArray.add(new Item(userIcon5,"menu6"));


gridView = (GridView) findViewById(R.id.gridView);

customGridAdapter = new CustomGridViewAdapter(this, R.layout.row_grid, gridArray);
gridView.setAdapter(customGridAdapter);
    
asked by anonymous 27.04.2016 / 02:25

1 answer

1

I usually do it this way:

gridView.setOnItemClickListener(new GridView.OnItemClickListener(){
            @Override
            public void onItemClick(AdapterView parent, View view, int position, long id) {
                // chamar sua intent

            }

        });
    
27.04.2016 / 15:28