1
votes

i wanna ask about how can i do an if-statement using the code below? I have tried it and it give me an error; its say cannot convert void to bool. any suggestion?

if(images.setVisibility(View.GONE)){
Display();
}
4

4 Answers

2
votes

You need to get visibilty and check it..

 if(images.getVisibility()==View.GONE){
        Display();
 }
0
votes

You can simply use below of the two codes:

  1. if(images.getVisibility==view.GONE) { Display(); }

the getVisibility() returns an integer.

you can also check with the integer code

i.e.

VISIBLE-0
GONE-8
INVISIBLE-4

2.

if(images.getVisibility==0)
//VISIBLE
if(images.getVisibility==4)
//INVISIBLE
if(images.getVisibility==8)
//GONE
0
votes

Try this:

if(images.getVisibility()==View.GONE){
            Display();
            }
0
votes

Make sure in your code, images.setVisibility() images must be instance of View. then use View.getVisibility() method

if(images.getVisibility() == View.GONE)
Display();