[Solved] how to start new activity via gridview onitemclick?


You can open activity using intent based on position

 gridView.setOnItemClickListener(new OnItemClickListener()
            {
                @Override
                public void onItemClick(AdapterView<?> arg0, View arg1, int position,
                                        long arg3) {
                    if(position==1) {
                        Intent intent = new Intent(GridViewExampleActivity.this, IndiaActivity.class);
                        startActivity(intent);
                    }
                    else if(position==2)
                    {
                        Intent intent = new Intent(GridViewExampleActivity.this, BrazilActivity.class);
                        startActivity(intent);

                    }
                    Toast.makeText(GridViewExampleActivity.this, mAdapter.getItem(position), Toast.LENGTH_SHORT).show();
                }
            });

1

solved how to start new activity via gridview onitemclick?