https://kotlinlang.org logo
#announcements
Title
# announcements
i

Irene Serrano

07/07/2021, 7:48 PM
Hello All, I'm having trouble converting the following java code into kotlin. Can I get your input? The Java code:
Copy code
if (hiddenView.getVisibility() == View.VISIBLE) {
     TransitionManager.beginDelayedTransition(cardView, new AutoTransition());
     hiddenView.setVisibility(View.GONE);
                   
}
My code:
Copy code
if (hiddenView.isVisible) {
     TransitionManager.beginDelayedTransition(cardView, AutoTransition())
     hiddenView.visibility = it.GONE
}
a

Alejandro Rios

07/07/2021, 7:49 PM
should be
View.GONE
instead of
it.GONE
i

Irene Serrano

07/07/2021, 7:51 PM
thank you!
l

Luke

07/07/2021, 8:12 PM
You can also write
hiddenView.isVisible = false
or
hiddenView.isGone = true
9 Views