Android, Configuring click listener for frame layout

androidandroid-layout

as you can see in following screen shot of my program, the screen includes several frames and each frame has two image views and a text view.
I want another activity starts, when user clicks on a frame (or imageView or textView).

In code, I have written:

final FrameLayout frame01 = (FrameLayout) findViewById(R.id.frame01);

but when I add following code, program crashes!

frame01.setOnClickListener(new View.OnClickListener() {         
            @Override
            public void onClick(View v) {
                Toast.makeText(Main.this, "Frame01 Selected", Toast.LENGTH_SHORT).show();
            }
        });

what should I do?
Thanks

enter image description here

Best Answer

Try to comment the following line:

Toast.makeText(Main.this, "Frame01 Selected", Toast.LENGTH_SHORT).show();

Are you sure you have the current class name "Main.java"?