```
button5.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                image5.setVisibility(View.VISIBLE);
                if(image5.getVisibility()==View.VISIBLE){
                    Toast.makeText(getApplicationContext(), "msg msg", Toast.LENGTH_SHORT).show();
                }
            }
        });

```

If I write like this, I can get information about button5's visibility and it makes a toast message.

```
 if(image5.getVisibility()==View.VISIBLE){
            Toast.makeText(getApplicationContext(), "msg msg", Toast.LENGTH_SHORT).show();
        }
        button5.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                image5.setVisibility(View.VISIBLE);

            }
        });

```

But if write the code like that, I can't get information about the visibility and there is no toast message. I need to learn the visibility outside of clickonlistener block. Can you help me? What do I need to do?