Android Cardview Multiple activities : I working on Android studio 3.0.1. I working a project on android cardview. I see a video tutorial on android cardview. I write code carefully. But when I run code, it saw some error.

[error screenshot on here][1]


My **MainActivity.java** code:

    private void setSingleEvent(GridLayout mainGrid) {
        //Loop all child item of Main Grid
        for (int i = 0; i < mainGrid.getChildCount(); i++) {
            //You can see , all child item is CardView , so we just cast object to CardView
            CardView cardView = (CardView) mainGrid.getChildAt(i);
            final int finalI = i;
            cardView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {

                    if (finalI == 0) //Teachers Activities
                    {
                        Intent intent = new Intent( packageContext: MainActivity.this, Teachers.class);
                        startActivity(intent);
                    }

                    else if (finalI == 1) //Students Activities
                    {
                        Intent intent = new Intent( packageContext: MainActivity.this, Students.class);
                        startActivity(intent);
                    }
                    else if (finalI == 2) //Students Activities
                    {
                        Intent intent = new Intent( packageContext: MainActivity.this, Students.class);
                        startActivity(intent);
                    }
                    else if (finalI == 3) //Notices Activities
                    {
                        Intent intent = new Intent( packageContext: MainActivity.this, Notices.class);
                        startActivity(intent);
                    }
                    else if (finalI == 4) //Results Activities
                    {
                        Intent intent = new Intent( packageContext: MainActivity.this, Results.class);
                        startActivity(intent);
                    }
                    else if (finalI == 5) //Phones Activities
                    {
                        Intent intent = new Intent( packageContext: MainActivity.this, Phones.class);
                        startActivity(intent);
                    }
                    else if (finalI == 6) //Blood Activities
                    {
                        Intent intent = new Intent( packageContext: MainActivity.this, Bloods.class);
                        startActivity(intent);
                    }
                    else {
                        Toast.makeText(MainActivity.this, "Activvvv", Toast.LENGTH_SHORT).show();
                    }


                }
            });
        }
    }
}


[Full Source code on here][2]


  [1]: https://i.stack.imgur.com/K2hsl.png
  [2]: https://drive.google.com/file/d/1zmzy6NMvrWsv3pBcf6jn9mg06uU49nHx/view